Skip to content

Commit b303206

Browse files
committed
Add missing migrations file
1 parent 0214b5e commit b303206

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

api/drf_views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def get_country_figure(self, request, pk):
280280

281281
all_appealhistory = AppealHistory.objects.select_related("appeal").filter(appeal__code__isnull=False)
282282
if start_date and end_date:
283-
all_appealhistory =all_appealhistory.filter(
283+
all_appealhistory = all_appealhistory.filter(
284284
start_date__lte=end_date, end_date__gte=start_date
285285
)
286286

@@ -463,6 +463,7 @@ def get_country_historical_disaster(self, request, pk):
463463
).data
464464
)
465465

466+
466467
class CountryRMDViewset(viewsets.ReadOnlyModelViewSet):
467468
queryset = Country.objects.filter(is_deprecated=False).filter(iso3__isnull=False).exclude(iso3="")
468469
filterset_class = CountryFilterRMD
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Django 3.2.24 on 2024-03-20 08:01
2+
3+
from django.db import migrations
4+
5+
def update_suported_by_oragnization_type(apps, schema_editor):
6+
# Update all the data with supported_by_organization_type=3
7+
CustomPerWorkPlanComponent = apps.get_model('per', 'CustomPerWorkPlanComponent')
8+
CustomPerWorkPlanComponent.objects.update(supported_by_organization_type=3)
9+
10+
class Migration(migrations.Migration):
11+
12+
dependencies = [
13+
('per', '0107_customperworkplancomponent_supported_by_organization_type'),
14+
]
15+
16+
operations = [
17+
migrations.RunPython(
18+
update_suported_by_oragnization_type,
19+
reverse_code=migrations.RunPython.noop
20+
),
21+
]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generated by Django 3.2.24 on 2024-03-20 08:04
2+
3+
from django.db import migrations
4+
5+
def update_description_to_null(apps, schema_editor):
6+
# delete description form component 34 and 14F
7+
FormComponent = apps.get_model('per', 'FormComponent')
8+
FormComponent.objects.filter(id=48).update(description=None)
9+
FormComponent.objects.filter(id=20).update(description=None)
10+
11+
class Migration(migrations.Migration):
12+
13+
dependencies = [
14+
('per', '0108_auto_20240320_0801'),
15+
]
16+
17+
operations = [
18+
migrations.RunPython(
19+
update_description_to_null,
20+
reverse_code=migrations.RunPython.noop
21+
),
22+
]

per/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ class Meta:
209209
def __str__(self):
210210
return self.text
211211

212+
212213
@reversion.register()
213214
class FormQuestionGroup(models.Model):
214215
component = models.ForeignKey(FormComponent, verbose_name=_("component"), on_delete=models.PROTECT)

0 commit comments

Comments
 (0)