|
3 | 3 | from django.utils.translation import ugettext_lazy as _ |
4 | 4 |
|
5 | 5 | from main.enums import TextChoices |
6 | | -from deployments.models import Sectors |
7 | | -from enumfields import EnumIntegerField |
8 | 6 | from api.models import ( |
9 | 7 | Country, |
10 | 8 | District, |
@@ -32,13 +30,26 @@ def __str__(self): |
32 | 30 |
|
33 | 31 |
|
34 | 32 | class EarlyAction(models.Model): |
35 | | - sector = EnumIntegerField(Sectors, verbose_name=_('sector')) |
| 33 | + class Sector(TextChoices): |
| 34 | + SHELTER_HOUSING_AND_SETTLEMENTS = 'shelter_housing_and_settlements', _('Shelter, Housing And Settlements') |
| 35 | + LIVELIHOODS = 'livelihoods', _('Livelihoods') |
| 36 | + MULTI_PURPOSE_CASH = 'multi-purpose_cash', _('Multi-purpose Cash') |
| 37 | + HEALTH_AND_CARE = 'health_and_care', _('Health And Care') |
| 38 | + WATER_SANITATION_AND_HYGIENE = 'water_sanitation_and_hygiene', _('Water, Sanitation And Hygiene') |
| 39 | + PROTECTION_GENDER_AND_INCLUSION = 'protection_gender_and_inclusion', _('Protection, Gender And Inclusion') |
| 40 | + EDUCATION = 'education', _('Education') |
| 41 | + MIGRATION = 'migration', _('Migration') |
| 42 | + RISK_REDUCTION_CLIMATE_ADAPTATION_AND_RECOVERY = \ |
| 43 | + 'risk_reduction_climate_adaptation_and_recovery', _('Risk Reduction, Climate Adaptation And Recovery') |
| 44 | + COMMUNITY_ENGAGEMENT_AND_ACCOUNTABILITY = \ |
| 45 | + 'community_engagement_and _accountability', _('Community Engagement And Accountability') |
| 46 | + ENVIRONMENT_SUSTAINABILITY = 'environment_sustainability ', _('Environment Sustainability') |
| 47 | + SHELTER_CLUSTER_COORDINATION = 'shelter_cluster_coordination', _('Shelter Cluster Coordination') |
| 48 | + |
| 49 | + sector = models.CharField(max_length=255, verbose_name=_('sector'), choices=Sector.choices) |
36 | 50 | budget_per_sector = models.IntegerField(verbose_name=_('Budget per sector (CHF)'), null=True, blank=True) |
37 | 51 | indicators = models.ManyToManyField(EarlyActionIndicator, verbose_name=_('Indicators'), blank=True) |
38 | | - |
39 | | - prioritized_risk = models.TextField(verbose_name=_('Prioritized risk'), null=True, blank=True) |
40 | 52 | targeted_people = models.IntegerField(verbose_name=_('Targeted people'), null=True, blank=True,) |
41 | | - |
42 | 53 | readiness_activities = models.TextField(verbose_name=_('Readiness Activities'), null=True, blank=True) |
43 | 54 | prepositioning_activities = models.TextField(verbose_name=_('Pre-positioning Activities'), null=True, blank=True) |
44 | 55 |
|
@@ -93,7 +104,7 @@ class Status(TextChoices): |
93 | 104 | DisasterType, on_delete=models.SET_NULL, verbose_name=_('Disaster Type'), |
94 | 105 | related_name='eap_disaster_type', null=True |
95 | 106 | ) |
96 | | - eap_number = models.CharField(max_length=50, editable=False, verbose_name=_('EAP Number')) |
| 107 | + eap_number = models.CharField(max_length=50, verbose_name=_('EAP Number')) |
97 | 108 | approval_date = models.DateField(verbose_name=_('Date of EAP Approval')) |
98 | 109 | status = models.CharField( |
99 | 110 | max_length=255, choices=Status.choices, default=Status.APPROVED, |
@@ -181,3 +192,20 @@ class Meta: |
181 | 192 |
|
182 | 193 | def __str__(self): |
183 | 194 | return f'{self.id}' |
| 195 | + |
| 196 | + |
| 197 | +class PrioritizedRisk(models.Model): |
| 198 | + early_action = models.ForeignKey( |
| 199 | + EarlyAction, |
| 200 | + on_delete=models.CASCADE, |
| 201 | + related_name='early_actions_prioritized_risk', |
| 202 | + verbose_name=_('early action') |
| 203 | + ) |
| 204 | + risks = models.TextField(null=True, blank=True) |
| 205 | + |
| 206 | + class Meta: |
| 207 | + verbose_name = _('Prioritized risk') |
| 208 | + verbose_name_plural = _('Prioritized risks') |
| 209 | + |
| 210 | + def __str__(self): |
| 211 | + return f'{self.id}' |
0 commit comments