Skip to content

Commit 1e2d51c

Browse files
committed
Add date fields in dref-op-update
1 parent c531188 commit 1e2d51c

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 3.2.18 on 2023-04-06 10:10
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('dref', '0054_auto_20230329_1409'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='drefoperationalupdate',
15+
name='date_of_approval',
16+
field=models.DateField(blank=True, null=True, verbose_name='Date of Approval'),
17+
),
18+
migrations.AddField(
19+
model_name='drefoperationalupdate',
20+
name='ns_request_date',
21+
field=models.DateField(blank=True, null=True, verbose_name='Ns request date'),
22+
),
23+
]

dref/models.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,17 @@ class DrefOperationalUpdate(models.Model):
943943
communication = models.TextField(
944944
blank=True, null=True, verbose_name=_("organization"), help_text=_("Does the NS have Communications capacity?")
945945
)
946+
# Fields only for DrefType: LOAN
947+
ns_request_date = models.DateField(
948+
verbose_name=_("Ns request date"),
949+
null=True,
950+
blank=True,
951+
)
952+
date_of_approval = models.DateField(
953+
verbose_name=_("Date of Approval"),
954+
null=True,
955+
blank=True,
956+
)
946957

947958
class Meta:
948959
verbose_name = _("Dref Operational Update")

dref/serializers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,8 @@ def create(self, validated_data):
530530
validated_data["people_in_need"] = dref.people_in_need
531531
validated_data["communication"] = dref.communication
532532
validated_data["total_operation_timeframe"] = dref.operation_timeframe
533+
validated_data['ns_request_date'] = dref.ns_request_date
534+
validated_data['date_of_approval'] = dref.date_of_approval
533535
operational_update = super().create(validated_data)
534536
# XXX: Copy files from DREF (Only nested serialized fields)
535537
nested_serialized_file_fields = [
@@ -629,6 +631,8 @@ def create(self, validated_data):
629631
validated_data["communication"] = dref_operational_update.communication
630632
validated_data["people_in_need"] = dref_operational_update.people_in_need
631633
validated_data["total_operation_timeframe"] = dref_operational_update.total_operation_timeframe
634+
validated_data['ns_request_date'] = dref_operational_update.ns_request_date
635+
validated_data['date_of_approval'] = dref_operational_update.date_of_approval
632636
operational_update = super().create(validated_data)
633637
# XXX: Copy files from DREF (Only nested serialized fields)
634638
nested_serialized_file_fields = [

0 commit comments

Comments
 (0)