@@ -392,10 +392,25 @@ class Sector(models.IntegerChoices):
392392 ENVIRONMENT_SUSTAINABILITY = 111 , _ ("Environment Sustainability" )
393393 COMMUNITY_ENGAGEMENT_AND_ACCOUNTABILITY = 112 , _ ("Community Engagement And Accountability" )
394394
395+ # NOTE: AP Codes are read only in EAP forms and passed through ENUMS for now.
396+ # They are not stored in the database but are derived from the sector field. Make sure to keep them in sync.
397+ class APCode (models .TextChoices ):
398+ SHELTER_SETTLEMENT_AND_HOUSING = "AP101, AP103, AP104" , _ ("AP101, AP103, AP104" )
399+ LIVELIHOODS = "AP007" , _ ("AP007" )
400+ PROTECTION_GENDER_AND_INCLUSION = "AP114, AP116, AP117" , _ ("AP114, AP116, AP117" )
401+ HEALTH_AND_CARE = "AP107, AP108, AP109" , _ ("AP107, AP108, AP109" )
402+ RISK_REDUCTION_CLIMATE_ADAPTATION_AND_RECOVERY = "AP101, AP103, AP104, AP105, AP106" , _ ("AP101, AP103, AP104, AP105, AP106" )
403+ MULTIPURPOSE_CASH = "AP081" , _ ("AP081" )
404+ WATER_SANITATION_AND_HYGIENE = "AP110, AP111" , _ ("AP110, AP111" )
405+ WASH = "AP110, AP111" , _ ("AP110, AP111" )
406+ EDUCATION = "AP115" , _ ("AP115" )
407+ MIGRATION = "AP112, AP113" , _ ("AP112, AP113" )
408+ ENVIRONMENT_SUSTAINABILITY = "AP102" , _ ("AP102" )
409+ COMMUNITY_ENGAGEMENT_AND_ACCOUNTABILITY = "AP129" , _ ("AP129" )
410+
395411 sector = models .IntegerField (choices = Sector .choices , verbose_name = _ ("sector" ))
396412 people_targeted = models .IntegerField (verbose_name = _ ("People Targeted" ))
397413 budget_per_sector = models .IntegerField (verbose_name = _ ("Budget per sector (CHF)" ))
398- ap_code = models .IntegerField (verbose_name = _ ("AP Code" ))
399414 previous_id = models .PositiveIntegerField (verbose_name = _ ("Previous ID" ), null = True , blank = True )
400415
401416 indicators = models .ManyToManyField (
@@ -439,6 +454,13 @@ class Approach(models.IntegerChoices):
439454 NATIONAL_SOCIETY_STRENGTHENING = 20 , _ ("National Society Strengthening" )
440455 PARTNERSHIP_AND_COORDINATION = 30 , _ ("Partnership And Coordination" )
441456
457+ # NOTE: AP Codes are read only in EAP forms and passed through ENUMS for now.
458+ # They are not stored in the database but are derived from the Approach field. Make sure to keep them in sync.
459+ class APCode (models .TextChoices ):
460+ SECRETARIAT_SERVICES = "AP122" , _ ("AP122" )
461+ NATIONAL_SOCIETY_STRENGTHENING = "AP124, AP125, AP126" , _ ("AP124, AP125, AP126" )
462+ PARTNERSHIP_AND_COORDINATION = "AP049, AP118, AP119, AP120, AP121, AP127, AP128" , _ ("AP049, AP118, AP119, AP120, AP121, AP127, AP128" )
463+
442464 approach = models .IntegerField (choices = Approach .choices , verbose_name = _ ("Approach" ))
443465 budget_per_approach = models .IntegerField (verbose_name = _ ("Budget per approach (CHF)" ))
444466 ap_code = models .IntegerField (verbose_name = _ ("AP Code" ))
0 commit comments