@@ -264,8 +264,14 @@ class DisasterCategory(models.IntegerChoices):
264264        RED  =  2 , _ ("Red" )
265265
266266    class  Status (models .IntegerChoices ):
267-         IN_PROGRESS  =  0 , _ ("In Progress" )
268-         COMPLETED  =  1 , _ ("Completed" )
267+         DRAFT  =  1 , _ ("Draft" )
268+         """Draft: Initial stage content is being created and is not ready for review.""" 
269+         FINALIZING  =  2 , _ ("Finalizing" )
270+         """Finalizing: Content is in the translation process from the original language into English.""" 
271+         FINALIZED  =  3 , _ ("Finalized" )
272+         """Finalized: Translation is completed, content is ready for review, and updates to the original language are locked.""" 
273+         APPROVED  =  4 , _ ("Approved" )
274+         """Approved: The content has been reviewed, accepted, and is ready for use.""" 
269275
270276    created_at  =  models .DateTimeField (verbose_name = _ ("created at" ), auto_now_add = True )
271277    modified_at  =  models .DateTimeField (verbose_name = _ ("modified at" ), default = timezone .now , null = True )
@@ -329,7 +335,13 @@ class Status(models.IntegerChoices):
329335        verbose_name = _ ("If available please upload additional support documentation for targeting strategy" ),
330336        related_name = "dref_targeting_strategy_support_file" ,
331337    )
332-     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. 
333345    num_assisted  =  models .IntegerField (verbose_name = _ ("number of assisted" ), blank = True , null = True )
334346    num_affected  =  models .IntegerField (verbose_name = _ ("number of affected" ), blank = True , null = True )
335347    estimated_number_of_affected_male  =  models .IntegerField (
@@ -645,10 +657,6 @@ class Status(models.IntegerChoices):
645657        verbose_name = _ ("cover image" ),
646658        related_name = "cover_image_dref" ,
647659    )
648-     is_published  =  models .BooleanField (
649-         default = False ,
650-         verbose_name = _ ("Is published" ),
651-     )
652660    is_final_report_created  =  models .BooleanField (
653661        default = False ,
654662        verbose_name = _ ("Is final report created" ),
@@ -748,8 +756,6 @@ def save(self, *args, **kwargs):
748756                self .budget_file_preview .save (filename , thumb_data , save = False )
749757            else :
750758                raise  ValidationError ({"budget_file" : "Sorry cannot generate preview for empty pdf" })
751- 
752-         self .status  =  Dref .Status .COMPLETED  if  self .is_published  else  Dref .Status .IN_PROGRESS 
753759        self .__budget_file_id  =  self .budget_file_id 
754760        super ().save (* args , ** kwargs )
755761
@@ -859,7 +865,13 @@ class DrefOperationalUpdate(models.Model):
859865    disaster_category  =  models .IntegerField (
860866        choices = Dref .DisasterCategory .choices , verbose_name = _ ("disaster category" ), null = True , blank = True 
861867    )
862-     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. 
863875    number_of_people_targeted  =  models .IntegerField (verbose_name = _ ("Number of people targeted" ), blank = True , null = True )
864876    number_of_people_affected  =  models .IntegerField (verbose_name = _ ("number of people affected" ), blank = True , null = True )
865877    estimated_number_of_affected_male  =  models .IntegerField (
@@ -1094,10 +1106,6 @@ class DrefOperationalUpdate(models.Model):
10941106        null = True ,
10951107    )
10961108    planned_interventions  =  models .ManyToManyField (PlannedIntervention , verbose_name = _ ("planned intervention" ), blank = True )
1097-     is_published  =  models .BooleanField (
1098-         default = False ,
1099-         verbose_name = _ ("Is published" ),
1100-     )
11011109    country  =  models .ForeignKey (
11021110        Country ,
11031111        verbose_name = _ ("country" ),
@@ -1232,7 +1240,6 @@ def save(self, *args, **kwargs):
12321240                raise  ValidationError ({"budget_file" : "Sorry cannot generate preview for empty pdf" })
12331241
12341242        self .__budget_file_id  =  self .budget_file_id 
1235-         self .status  =  Dref .Status .COMPLETED  if  self .is_published  else  Dref .Status .IN_PROGRESS 
12361243        super ().save (* args , ** kwargs )
12371244
12381245    @staticmethod  
@@ -1297,7 +1304,13 @@ class DrefFinalReport(models.Model):
12971304    disaster_category  =  models .IntegerField (
12981305        choices = Dref .DisasterCategory .choices , verbose_name = _ ("disaster category" ), null = True , blank = True 
12991306    )
1300-     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. 
13011314    number_of_people_targeted  =  models .IntegerField (verbose_name = _ ("Number of people targeted" ), blank = True , null = True )
13021315    number_of_people_affected  =  models .IntegerField (verbose_name = _ ("number of people affected" ), blank = True , null = True )
13031316    estimated_number_of_affected_male  =  models .IntegerField (
@@ -1481,7 +1494,6 @@ class DrefFinalReport(models.Model):
14811494        verbose_name = _ ("Additional National Societies Actions" ), null = True , blank = True 
14821495    )
14831496    planned_interventions  =  models .ManyToManyField (PlannedIntervention , verbose_name = _ ("planned intervention" ), blank = True )
1484-     is_published  =  models .BooleanField (verbose_name = _ ("Is Published" ), default = False )
14851497    country  =  models .ForeignKey (
14861498        Country ,
14871499        verbose_name = _ ("country" ),
@@ -1651,12 +1663,11 @@ def save(self, *args, **kwargs):
16511663            else :
16521664                raise  ValidationError ({"financial_report" : "Sorry cannot generate preview for empty pdf" })
16531665
1654-         self .status  =  Dref .Status .COMPLETED  if  self .is_published  else  Dref .Status .IN_PROGRESS 
16551666        self .__financial_report_id  =  self .financial_report_id 
16561667        super ().save (* args , ** kwargs )
16571668
16581669    @staticmethod  
1659-     def  get_for (user , is_published = False ):
1670+     def  get_for (user , status = None ):
16601671        from  dref .utils  import  get_dref_users 
16611672
16621673        # get the user in dref 
@@ -1675,6 +1686,6 @@ def get_for(user, is_published=False):
16751686        final_report_created_by  =  DrefFinalReport .objects .filter (created_by = user ).distinct ()
16761687        union_query  =  final_report_users .union (final_report_created_by )
16771688        queryset  =  DrefFinalReport .objects .filter (id__in = union_query .values ("id" )).distinct ()
1678-         if  is_published :
1679-             return  queryset .filter (is_published = True )
1689+         if  status   ==   Dref . Status . APPROVED :
1690+             return  queryset .filter (status = Dref . Status . APPROVED )
16801691        return  queryset 
0 commit comments