Skip to content

Commit 8be39fe

Browse files
Merge pull request #1803 from IFRCGo/feature/dref-approval
Feature/dref approval
2 parents 2ca8737 + 405dde6 commit 8be39fe

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.2.19 on 2023-06-06 06:16
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('dref', '0059_drefoperationalupdate_identified_gaps'),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name='dreffinalreport',
15+
name='date_of_approval',
16+
field=models.DateField(blank=True, null=True, verbose_name='Date of Approval'),
17+
),
18+
]

dref/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,11 @@ class DrefFinalReport(models.Model):
12681268
verbose_name=_("National Society conducted description"), null=True, blank=True
12691269
)
12701270
financial_report_description = models.TextField(verbose_name=_("Financial Report Description"), null=True, blank=True)
1271+
date_of_approval = models.DateField(
1272+
verbose_name=_("Date of Approval"),
1273+
null=True,
1274+
blank=True,
1275+
)
12711276

12721277
class Meta:
12731278
verbose_name = _("Dref Final Report")

dref/serializers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class Meta:
8787
"is_published",
8888
"status",
8989
"status_display",
90+
"date_of_approval"
9091
]
9192

9293
def get_application_type(self, obj):
@@ -120,7 +121,8 @@ class Meta:
120121
"application_type",
121122
"application_type_display",
122123
"status",
123-
"status_display"
124+
"status_display",
125+
"date_of_approval"
124126
]
125127

126128
def get_application_type(self, obj):
@@ -173,6 +175,7 @@ class Meta:
173175
"unpublished_final_report_count",
174176
"status",
175177
"status_display",
178+
"date_of_approval"
176179
]
177180

178181
def get_operational_update_details(self, obj):

dref/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from operator import attrgetter
33

44
from django.utils.translation import gettext
5+
import django.utils.timezone as timezone
56
from reversion.views import RevisionMixin
67

78
from rest_framework import (
@@ -163,7 +164,8 @@ def get_published(self, request, pk=None, version=None):
163164
field_report.save(update_fields=["is_published", "status"])
164165
if not field_report.dref.is_final_report_created:
165166
field_report.dref.is_final_report_created = True
166-
field_report.dref.save(update_fields=["is_final_report_created"])
167+
field_report.date_of_approval = timezone.now().date()
168+
field_report.dref.save(update_fields=["is_final_report_created", "date_of_approval"])
167169
serializer = DrefFinalReportSerializer(field_report, context={"request": request})
168170
return response.Response(serializer.data)
169171

0 commit comments

Comments
 (0)