Skip to content

Commit 82ab62d

Browse files
committed
feat(dref): Skips fields on dref translation
1 parent bd8ce6d commit 82ab62d

File tree

1 file changed

+140
-37
lines changed

1 file changed

+140
-37
lines changed

dref/translation.py

Lines changed: 140 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
from modeltranslation.translator import TranslationOptions, register
22

3-
from dref.models import Dref, DrefFinalReport, DrefOperationalUpdate
4-
5-
"""
6-
NOTE:Commenting out for now as, we are currently
7-
working on translation feature on dref
8-
"""
3+
from dref.models import (
4+
Dref,
5+
DrefFile,
6+
DrefFinalReport,
7+
DrefOperationalUpdate,
8+
IdentifiedNeed,
9+
NationalSocietyAction,
10+
PlannedIntervention,
11+
PlannedInterventionIndicators,
12+
RiskSecurity,
13+
)
914

1015

1116
@register(Dref)
@@ -14,7 +19,34 @@ class DrefTO(TranslationOptions):
1419
"title",
1520
"title_prefix",
1621
"event_text",
22+
"ns_request_text",
23+
"dref_recurrent_text",
24+
"lessons_learned",
25+
"child_safeguarding_risk_level",
26+
"event_description",
27+
"anticipatory_actions",
28+
"event_scope",
29+
"national_authorities",
30+
"ifrc",
31+
"icrc",
32+
"partner_national_society",
33+
"un_or_other_actor",
34+
"major_coordination_mechanism",
35+
"identified_gaps",
36+
"people_assisted",
37+
"selection_criteria",
38+
"operation_objective",
39+
"response_strategy",
40+
"human_resource",
41+
"is_volunteer_team_diverse",
42+
"surge_personnel_deployed",
43+
"logistic_capacity_of_ns",
44+
"pmer",
45+
"communication",
46+
"risk_security_concern",
1747
)
48+
# NOTE: Adding skip_fields temporarily to avoid removing previously translated data
49+
# TODO(sudip): Remove skip_fields after dref translation feature is implemented
1850
skip_fields = (
1951
"ns_request_text",
2052
"dref_recurrent_text",
@@ -44,17 +76,38 @@ class DrefTO(TranslationOptions):
4476
)
4577

4678

47-
# @register(DrefFile)
48-
# class DrefFileTO(TranslationOptions):
49-
# fields = ("caption",)
79+
@register(DrefFile)
80+
class DrefFileTO(TranslationOptions):
81+
fields = ("caption",)
82+
# NOTE: Adding skip_fields temporarily to avoid removing previously translated data
83+
# TODO(sudip): Remove skip_fields after dref translation feature is implemented
84+
skip_fields = ("caption",)
5085

5186

5287
@register(DrefFinalReport)
5388
class DrefFinalReportTO(TranslationOptions):
5489
fields = (
5590
"title",
5691
"title_prefix",
92+
"event_description",
93+
"anticipatory_actions",
94+
"event_scope",
95+
"ifrc",
96+
"icrc",
97+
"partner_national_society",
98+
"national_authorities",
99+
"un_or_other_actor",
100+
"selection_criteria",
101+
"operation_objective",
102+
"response_strategy",
103+
"major_coordination_mechanism",
104+
"risk_security_concern",
105+
"event_text",
106+
"national_society_conducted_description",
107+
"financial_report_description",
57108
)
109+
# NOTE: Adding skip_fields temporarily to avoid removing previously translated data
110+
# TODO(sudip): Remove skip_fields after dref translation feature is implemented
58111
skip_fields = (
59112
"event_description",
60113
"anticipatory_actions",
@@ -82,7 +135,28 @@ class DrefOperationalUpdateTO(TranslationOptions):
82135
"title_prefix",
83136
"event_description",
84137
"anticipatory_actions",
138+
"event_scope",
139+
"ifrc",
140+
"icrc",
141+
"partner_national_society",
142+
"national_authorities",
143+
"un_or_other_actor",
144+
"major_coordination_mechanism",
145+
"people_assisted",
146+
"selection_criteria",
147+
"operation_objective",
148+
"response_strategy",
149+
"risk_security_concern",
150+
"anticipatory_to_response",
151+
"human_resource",
152+
"is_volunteer_team_diverse",
153+
"surge_personnel_deployed",
154+
"logistic_capacity_of_ns",
155+
"pmer",
156+
"communication",
85157
)
158+
# NOTE: Adding skip_fields temporarily to avoid removing previously translated data
159+
# TODO(sudip): Remove skip_fields after dref translation feature is implemented
86160
skip_fields = (
87161
"event_scope",
88162
"ifrc",
@@ -106,38 +180,67 @@ class DrefOperationalUpdateTO(TranslationOptions):
106180
)
107181

108182

109-
# @register(IdentifiedNeed)
110-
# class IdentifiedNeedTO(TranslationOptions):
111-
# fields = (
112-
# "title",
113-
# "description",
114-
# )
183+
@register(IdentifiedNeed)
184+
class IdentifiedNeedTO(TranslationOptions):
185+
fields = (
186+
"title",
187+
"description",
188+
)
189+
# NOTE: Adding skip_fields temporarily to avoid removing previously translated data
190+
# TODO(sudip): Remove skip_fields after dref translation feature is implemented
191+
skip_fields = (
192+
"title",
193+
"description",
194+
)
115195

116196

117-
# @register(NationalSocietyAction)
118-
# class NationalSocietyActionTO(TranslationOptions):
119-
# fields = ("description",)
197+
@register(NationalSocietyAction)
198+
class NationalSocietyActionTO(TranslationOptions):
199+
fields = ("description",)
200+
# NOTE: Adding skip_fields temporarily to avoid removing previously translated data
201+
# TODO(sudip): Remove skip_fields after dref translation feature is implemented
202+
skip_fields = ("description",)
120203

121204

122-
# @register(PlannedIntervention)
123-
# class PlannedInterventionTO(TranslationOptions):
124-
# fields = (
125-
# "title",
126-
# "description",
127-
# "progress_towards_outcome",
128-
# "narrative_description_of_achievements",
129-
# "challenges",
130-
# "lessons_learnt",
131-
# )
205+
@register(PlannedIntervention)
206+
class PlannedInterventionTO(TranslationOptions):
207+
fields = (
208+
"title",
209+
"description",
210+
"progress_towards_outcome",
211+
"narrative_description_of_achievements",
212+
"challenges",
213+
"lessons_learnt",
214+
)
215+
# NOTE: Adding skip_fields temporarily to avoid removing previously translated data
216+
# TODO(sudip): Remove skip_fields after dref translation feature is implemented
217+
skip_fields = (
218+
"title",
219+
"description",
220+
"progress_towards_outcome",
221+
"narrative_description_of_achievements",
222+
"challenges",
223+
"lessons_learnt",
224+
)
225+
132226

133-
# @register(PlannedInterventionIndicators)
134-
# class PlannedInterventionIndicatorsTO(TranslationOptions):
135-
# fields = ("title",)
227+
@register(PlannedInterventionIndicators)
228+
class PlannedInterventionIndicatorsTO(TranslationOptions):
229+
fields = ("title",)
230+
# NOTE: Adding skip_fields temporarily to avoid removing previously translated data
231+
# TODO(sudip): Remove skip_fields after dref translation feature is implemented
232+
skip_fields = ("title",)
136233

137234

138-
# @register(RiskSecurity)
139-
# class RiskSecurityTO(TranslationOptions):
140-
# fields = (
141-
# "risk",
142-
# "mitigation",
143-
# )
235+
@register(RiskSecurity)
236+
class RiskSecurityTO(TranslationOptions):
237+
fields = (
238+
"risk",
239+
"mitigation",
240+
)
241+
# NOTE: Adding skip_fields temporarily to avoid removing previously translated data
242+
# TODO(sudip): Remove skip_fields after dref translation feature is implemented
243+
skip_fields = (
244+
"risk",
245+
"mitigation",
246+
)

0 commit comments

Comments
 (0)