Skip to content

Commit c1ac5ac

Browse files
committed
fixup! feat(eap): Add email setup and template
1 parent 832c190 commit c1ac5ac

File tree

5 files changed

+20
-13
lines changed

5 files changed

+20
-13
lines changed

eap/tasks.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,22 @@ def send_new_eap_registration_email(eap_registration_id: int):
3030
settings.EMAIL_EAP_DREF_ANTICIPATORY_PILLAR,
3131
instance.ifrc_contact_email,
3232
]
33-
cc_recipients = [
34-
instance.national_society_contact_email,
35-
*settings.EMAIL_EAP_DREF_AA_GLOBAL_TEAM,
36-
*regional_coordinator_emails,
37-
]
33+
cc_recipients = list(
34+
set(
35+
[
36+
instance.national_society_contact_email,
37+
*settings.EMAIL_EAP_DREF_AA_GLOBAL_TEAM,
38+
*regional_coordinator_emails,
39+
]
40+
)
41+
)
3842
email_context = get_eap_registration_email_context(instance)
39-
email_subject = f"[{instance.get_eap_type_display()} IN DEVELOPMENT] {instance.country} {instance.disaster_type}"
43+
email_subject = (
44+
f"[{instance.get_eap_type_display() if instance.get_eap_type_display() else 'EAP'} IN DEVELOPMENT] "
45+
f"{instance.country} {instance.disaster_type}"
46+
)
4047
email_body = render_to_string("email/eap/registration.html", email_context)
41-
email_type = "EAP-REGISTRATION"
48+
email_type = "New EAP Registration"
4249

4350
send_notification(
4451
subject=email_subject,

eap/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def get_eap_registration_email_context(instance):
4747
"ns_contact_name": eap_registration_data["national_society_contact_name"],
4848
"ns_contact_email": eap_registration_data["national_society_contact_email"],
4949
"ns_contact_phone": eap_registration_data["national_society_contact_phone_number"],
50-
"status_display": eap_registration_data["status_display"],
5150
"frontend_url": settings.GO_WEB_URL,
5251
}
5352
return email_context

notifications/templates/email/eap/re-submission.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
Type of EAP
2626
</td>
2727
<td style="border:1px solid #000000;">
28-
{{ eap_type_display }}
28+
{{ eap_type_display|default:"Not Sure" }}
2929
</td>
3030
</tr>
3131
<tr>

notifications/templates/email/eap/registration.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</p>
1111
<p>
1212
<span style="text-transform: uppercase; font-weight: bold;">{{ national_society }}</span>, wishes to inform the IFRC-DREF Team that has started to work on the development of an
13-
<span style="text-transform: uppercase; font-weight: bold;">{{ eap_type_display }}</span>.
13+
<span style="text-transform: uppercase; font-weight: bold;"> {{ eap_type_display|default:"EAP" }}</span>.
1414
</p>
1515

1616
<!-- Main data table -->
@@ -21,7 +21,7 @@
2121
</tr>
2222
<tr>
2323
<td style="font-weight: bold;">Type of EAP</td>
24-
<td>{{ eap_type_display }}</td>
24+
<td> {{ eap_type_display|default:"Not Sure" }} </td>
2525
</tr>
2626
<tr>
2727
<td style="font-weight: bold;">Hazard</td>
@@ -40,6 +40,7 @@
4040
</table>
4141

4242
<!-- Signature -->
43+
<p>You can check the progress of this EAP <a href="{{ frontend_url }}/eap-registration/{{ registration_id }}/">here.</a></p>
4344
<p style="margin-top:16px;">
4445
Kind regards,<br>
4546
{{ ns_contact_name }}<br>

notifications/templates/email/eap/submission.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<td style="line-height:1.6;">
66
<p style="font-weight: bold;">Dear colleagues,</p>
77
<p>
8-
<span style="text-transform: uppercase; font-weight: bold;">{{ national_society }}</span> is hereby submiting the following {{ eap_type_display }}
8+
<span style="text-transform: uppercase; font-weight: bold;">{{ national_society }}</span> is hereby submiting the following {{ eap_type_display|default:"Not Sure" }}
99
to the IFRC-DREF for technical review and approval:
1010
</p>
1111

@@ -20,7 +20,7 @@
2020
</tr>
2121
<tr>
2222
<td style="border:1px solid #000000; width:40%; font-weight: bold;">Type of EAP</td>
23-
<td style="border:1px solid #000000;">{{ eap_type_display }}</td>
23+
<td style="border:1px solid #000000;">{{ eap_type_display|default:"Not Sure" }}</td>
2424
</tr>
2525
<tr>
2626
<td style="border:1px solid #000000; width:40%; font-weight: bold;">Hazard</td>

0 commit comments

Comments
 (0)