@@ -264,13 +264,14 @@ class DisasterCategory(models.IntegerChoices):
264264 RED = 2 , _ ("Red" )
265265
266266 class Status (models .IntegerChoices ):
267- # NOTE: Updated statuses for clarity:
268- # IN_PROGRESS → DRAFT, COMPLETED → APPROVED.
269- # Added FINALIZING and FINALIZED for translation/finalization.
270267 DRAFT = 1 , _ ("Draft" )
268+ """Draft: Initial stage content is being created and is not ready for review."""
271269 FINALIZING = 2 , _ ("Finalizing" )
270+ """Finalizing: Content is in the translation process from the original language into English."""
272271 FINALIZED = 3 , _ ("Finalized" )
272+ """Finalized: Translation is completed, content is ready for review, and updates to the original language are locked."""
273273 APPROVED = 4 , _ ("Approved" )
274+ """Approved: The content has been reviewed, accepted, and is ready for use."""
274275
275276 created_at = models .DateTimeField (verbose_name = _ ("created at" ), auto_now_add = True )
276277 modified_at = models .DateTimeField (verbose_name = _ ("modified at" ), default = timezone .now , null = True )
@@ -334,7 +335,13 @@ class Status(models.IntegerChoices):
334335 verbose_name = _ ("If available please upload additional support documentation for targeting strategy" ),
335336 related_name = "dref_targeting_strategy_support_file" ,
336337 )
337- status = models .IntegerField (choices = Status .choices , verbose_name = _ ("status" ), null = True , blank = True )
338+ status = models .IntegerField (choices = Status .choices , verbose_name = _ ("status" ), default = Status .DRAFT )
339+ original_language = models .CharField (
340+ blank = True ,
341+ null = True ,
342+ verbose_name = _ ("Original language" ),
343+ help_text = "The language in which this record was first created." ,
344+ ) # NOTE: This field is set at creation with the active language.
338345 num_assisted = models .IntegerField (verbose_name = _ ("number of assisted" ), blank = True , null = True )
339346 num_affected = models .IntegerField (verbose_name = _ ("number of affected" ), blank = True , null = True )
340347 estimated_number_of_affected_male = models .IntegerField (
@@ -650,10 +657,6 @@ class Status(models.IntegerChoices):
650657 verbose_name = _ ("cover image" ),
651658 related_name = "cover_image_dref" ,
652659 )
653- is_published = models .BooleanField (
654- default = False ,
655- verbose_name = _ ("Is published" ),
656- )
657660 is_final_report_created = models .BooleanField (
658661 default = False ,
659662 verbose_name = _ ("Is final report created" ),
@@ -862,7 +865,13 @@ class DrefOperationalUpdate(models.Model):
862865 disaster_category = models .IntegerField (
863866 choices = Dref .DisasterCategory .choices , verbose_name = _ ("disaster category" ), null = True , blank = True
864867 )
865- status = models .IntegerField (choices = Dref .Status .choices , verbose_name = _ ("status" ), null = True , blank = True )
868+ status = models .IntegerField (choices = Dref .Status .choices , verbose_name = _ ("status" ), default = Dref .Status .DRAFT )
869+ original_language = models .CharField (
870+ blank = True ,
871+ null = True ,
872+ verbose_name = _ ("Original language" ),
873+ help_text = "The language in which this record was first created." ,
874+ ) # NOTE: This field is set at creation with the active language.
866875 number_of_people_targeted = models .IntegerField (verbose_name = _ ("Number of people targeted" ), blank = True , null = True )
867876 number_of_people_affected = models .IntegerField (verbose_name = _ ("number of people affected" ), blank = True , null = True )
868877 estimated_number_of_affected_male = models .IntegerField (
@@ -1097,10 +1106,6 @@ class DrefOperationalUpdate(models.Model):
10971106 null = True ,
10981107 )
10991108 planned_interventions = models .ManyToManyField (PlannedIntervention , verbose_name = _ ("planned intervention" ), blank = True )
1100- is_published = models .BooleanField (
1101- default = False ,
1102- verbose_name = _ ("Is published" ),
1103- )
11041109 country = models .ForeignKey (
11051110 Country ,
11061111 verbose_name = _ ("country" ),
@@ -1299,7 +1304,13 @@ class DrefFinalReport(models.Model):
12991304 disaster_category = models .IntegerField (
13001305 choices = Dref .DisasterCategory .choices , verbose_name = _ ("disaster category" ), null = True , blank = True
13011306 )
1302- status = models .IntegerField (choices = Dref .Status .choices , verbose_name = _ ("status" ), null = True , blank = True )
1307+ status = models .IntegerField (choices = Dref .Status .choices , verbose_name = _ ("status" ), default = Dref .Status .DRAFT )
1308+ original_language = models .CharField (
1309+ blank = True ,
1310+ null = True ,
1311+ verbose_name = _ ("Original language" ),
1312+ help_text = "The language in which this record was first created." ,
1313+ ) # NOTE: This field is set at creation with the active language.
13031314 number_of_people_targeted = models .IntegerField (verbose_name = _ ("Number of people targeted" ), blank = True , null = True )
13041315 number_of_people_affected = models .IntegerField (verbose_name = _ ("number of people affected" ), blank = True , null = True )
13051316 estimated_number_of_affected_male = models .IntegerField (
@@ -1483,7 +1494,6 @@ class DrefFinalReport(models.Model):
14831494 verbose_name = _ ("Additional National Societies Actions" ), null = True , blank = True
14841495 )
14851496 planned_interventions = models .ManyToManyField (PlannedIntervention , verbose_name = _ ("planned intervention" ), blank = True )
1486- is_published = models .BooleanField (verbose_name = _ ("Is Published" ), default = False )
14871497 country = models .ForeignKey (
14881498 Country ,
14891499 verbose_name = _ ("country" ),
@@ -1657,7 +1667,7 @@ def save(self, *args, **kwargs):
16571667 super ().save (* args , ** kwargs )
16581668
16591669 @staticmethod
1660- def get_for (user , is_published = False ):
1670+ def get_for (user , status = None ):
16611671 from dref .utils import get_dref_users
16621672
16631673 # get the user in dref
@@ -1676,6 +1686,6 @@ def get_for(user, is_published=False):
16761686 final_report_created_by = DrefFinalReport .objects .filter (created_by = user ).distinct ()
16771687 union_query = final_report_users .union (final_report_created_by )
16781688 queryset = DrefFinalReport .objects .filter (id__in = union_query .values ("id" )).distinct ()
1679- if is_published :
1680- return queryset .filter (is_published = True )
1689+ if status == Dref . Status . APPROVED :
1690+ return queryset .filter (status = Dref . Status . APPROVED )
16811691 return queryset
0 commit comments