|
2 | 2 | from django.contrib.auth.models import User |
3 | 3 | from django.utils import timezone |
4 | 4 | from django.utils.translation import gettext_lazy as _ |
| 5 | +from django.core.validators import FileExtensionValidator |
5 | 6 |
|
6 | 7 | from api.models import Country |
7 | 8 |
|
@@ -63,8 +64,18 @@ def save(self, *args, **kwargs): |
63 | 64 |
|
64 | 65 | class CountryPlan(CountryPlanAbstract): |
65 | 66 | country = models.OneToOneField(Country, on_delete=models.CASCADE, related_name='country_plan', primary_key=True) |
66 | | - internal_plan_file = models.FileField(verbose_name=_('Internal Plan'), upload_to=pdf_upload_to, blank=True, null=True) |
67 | | - public_plan_file = models.FileField(verbose_name=_('Country Plan'), upload_to=pdf_upload_to, blank=True, null=True) |
| 67 | + internal_plan_file = models.FileField( |
| 68 | + verbose_name=_('Internal Plan'), |
| 69 | + upload_to=pdf_upload_to, |
| 70 | + validators=[FileExtensionValidator(['pdf'])], |
| 71 | + blank=True, null=True |
| 72 | + ) |
| 73 | + public_plan_file = models.FileField( |
| 74 | + verbose_name=_('Country Plan'), |
| 75 | + validators=[FileExtensionValidator(['pdf'])], |
| 76 | + upload_to=pdf_upload_to, |
| 77 | + blank=True, null=True |
| 78 | + ) |
68 | 79 | requested_amount = models.FloatField(verbose_name=_('Requested Amount'), blank=True, null=True) |
69 | 80 | people_targeted = models.IntegerField(verbose_name=_('People Targeted'), blank=True, null=True) |
70 | 81 | is_publish = models.BooleanField(default=False, verbose_name=_('Published')) |
@@ -98,6 +109,7 @@ def full_country_plan_mc(self): |
98 | 109 |
|
99 | 110 | class StrategicPriority(models.Model): |
100 | 111 | class Type(models.TextChoices): |
| 112 | + ONGOING_EMERGENCY_OPERATIONS = 'ongoing_emergency_operations', _('Ongoing emergency operations') |
101 | 113 | CLIMATE_AND_ENVIRONMENTAL_CRISIS = 'climate_and_environmental_crisis', _('Climate and environmental crisis') |
102 | 114 | EVOLVING_CRISIS_AND_DISASTERS = 'evolving_crisis_and_disasters', _('Evolving crisis and disasters') |
103 | 115 | GROWING_GAPS_IN_HEALTH_AND_WELLBEING = 'growing_gaps_in_health_and_wellbeing', _('Growing gaps in health and wellbeing') |
|
0 commit comments