Skip to content

Commit d481add

Browse files
Merge pull request #1630 from IFRCGo/fix/no-appeal-title-when-void
Choice fields in notifs – strings instead of numbers
2 parents 3e1095d + 0b65cf1 commit d481add

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

api/management/commands/index_and_notify.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ def construct_template_record(self, rtype, record):
483483
'other_fields': {
484484
'appeal': record.get_appeal_display(),
485485
'appeal_amount': record.appeal_amount,
486-
'bulletin': record.bulletin,
486+
'bulletin': record.get_bulletin_display(),
487487
'countries': ', '.join(i.name for i in record.countries.all()),
488488
'contacts': [{'ctype': c.ctype,
489489
'name': c.name,
@@ -492,59 +492,59 @@ def construct_template_record(self, rtype, record):
492492
'phone': c.phone} for c in record.contacts.all()[::-1]],
493493
#not used this way, but shortened: 'description': record.description,
494494
'districts': ', '.join(i.name for i in record.districts.all()),
495-
'dref': record.dref,
495+
'dref': record.get_dref_display(),
496496
'dref_amount': record.dref_amount,
497497
'epi_cases_since_last_fr': record.epi_cases_since_last_fr,
498498
'epi_deaths_since_last_fr': record.epi_deaths_since_last_fr,
499499
'epi_notes_since_last_fr': record.epi_notes_since_last_fr.split("\n") if record.epi_notes_since_last_fr else None,
500-
'eru_base_camp': record.eru_base_camp,
500+
'eru_base_camp': record.get_eru_base_camp_display(),
501501
'eru_base_camp_units': record.eru_base_camp_units,
502-
'eru_basic_health_care': record.eru_basic_health_care,
502+
'eru_basic_health_care': record.get_eru_basic_health_care_display(),
503503
'eru_basic_health_care_units': record.eru_basic_health_care_units,
504-
'eru_deployment_hospital': record.eru_deployment_hospital,
504+
'eru_deployment_hospital': record.get_eru_deployment_hospital_display(),
505505
'eru_deployment_hospital_units': record.eru_deployment_hospital_units,
506-
'eru_it_telecom': record.eru_it_telecom,
506+
'eru_it_telecom': record.get_eru_it_telecom_display(),
507507
'eru_it_telecom_units': record.eru_it_telecom_units,
508-
'eru_logistics': record.eru_logistics,
508+
'eru_logistics': record.get_eru_logistics_display(),
509509
'eru_logistics_units': record.eru_logistics_units,
510-
'eru_referral_hospital': record.eru_referral_hospital,
510+
'eru_referral_hospital': record.get_eru_referral_hospital_display(),
511511
'eru_referral_hospital_units': record.eru_referral_hospital_units,
512-
'eru_relief': record.eru_relief,
512+
'eru_relief': record.get_eru_relief_display(),
513513
'eru_relief_units': record.eru_relief_units,
514-
'eru_water_sanitation_15': record.eru_water_sanitation_15,
514+
'eru_water_sanitation_15': record.get_eru_water_sanitation_15_display(),
515515
'eru_water_sanitation_15_units': record.eru_water_sanitation_15_units,
516-
'eru_water_sanitation_20': record.eru_water_sanitation_20,
516+
'eru_water_sanitation_20': record.get_eru_water_sanitation_20_display(),
517517
'eru_water_sanitation_20_units': record.eru_water_sanitation_20_units,
518-
'eru_water_sanitation_40': record.eru_water_sanitation_40,
518+
'eru_water_sanitation_40': record.get_eru_water_sanitation_40_display(),
519519
'eru_water_sanitation_40_units': record.eru_water_sanitation_40_units,
520520
'event': record.event,
521521
'external_partners': ', '.join(i.name for i in record.external_partners.all()),
522-
'forecast_based_action': record.forecast_based_action,
522+
'forecast_based_action': record.get_forecast_based_action_display(),
523523
'forecast_based_action_amount': record.forecast_based_action_amount,
524-
'imminent_dref': record.imminent_dref,
524+
'imminent_dref': record.get_imminent_dref_display(),
525525
'imminent_dref_amount': record.imminent_dref_amount,
526526
'notes_health': record.notes_health,
527527
'notes_ns': record.notes_ns,
528528
'notes_socioeco': record.notes_socioeco,
529529
'other_sources': record.other_sources.split("\n") if record.other_sources else None,
530530
'start_date': record.start_date,
531531
'supported_activities': ', '.join(i.name for i in record.supported_activities.all()),
532-
# not used: 'fact': record.fact,
532+
# not used: 'fact': record.fact, !get_..._display!
533533
# not used: 'affected_pop_centres': record.affected_pop_centres,
534534
# not used: 'gov_affected_pop_centres': record.gov_affected_pop_centres,
535535
# not used: 'gov_num_highest_risk': record.gov_num_highest_risk,
536536
# not used: 'gov_num_potentially_affected': record.gov_num_potentially_affected,
537537
# not used: 'health_min_num_assisted': record.health_min_num_assisted,
538538
# not used: 'who_num_assisted': record.who_num_assisted,
539-
# not used: 'ifrc_staff': record.ifrc_staff,
539+
# not used: 'ifrc_staff': record.ifrc_staff, !get_..._display!
540540
# not used: 'is_covid_report': record.is_covid_report,
541541
# not used: 'num_expats_delegates': record.num_expats_delegates,
542542
# not used: 'num_fact': record.num_fact,
543543
# not used: 'num_highest_risk': record.num_highest_risk,
544544
# not used: 'num_ifrc_staff': record.num_ifrc_staff,
545545
# not used: 'num_localstaff': record.num_localstaff,
546546
# not used: 'num_potentially_affected': record.num_potentially_affected,
547-
# not used: 'rdrt': record.rdrt,
547+
# not used: 'rdrt': record.rdrt, !get_..._display!
548548
# not used: 'num_rdrt': record.num_rdrt,
549549
# not used: 'num_volunteers': record.num_volunteers,
550550
# not used: 'other_affected_pop_centres': record.other_affected_pop_centres,

notifications/templates/design/main_field_report.html

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
National Society: {{ fr.ns_assistance }}
261261
</td>
262262
</tr>
263-
{% if fr.other_fields.bulletin %}
263+
{% if fr.other_fields.bulletin != 'No' %}
264264
<tr>
265265
<td class="text-default text-light pb-10" style="color: #000000;font-family:'Lato', Arial, sans-serif;padding-bottom: 10px;font-weight: 300;">
266266
Information Bulletin: {{ fr.other_fields.bulletin }}
@@ -343,7 +343,7 @@
343343
<tr>
344344
<td>
345345
<table width="100%" border="0" cellspacing="0" cellpadding="6" bgcolor="#ffffff" style="font-family: 'Lato', Arial, sans-serif">
346-
{% if fr.other_fields.dref %}
346+
{% if fr.other_fields.dref != 'No' %}
347347
<tr>
348348
<td align="left" style="font-weight: bold" width="30%">
349349
DREF Request
@@ -361,7 +361,7 @@
361361
{{ fr.other_fields.dref_amount|floatformat:"1"|intcomma|slice:":-2" }} </td>
362362
</tr>
363363
{% endif %}
364-
{% if fr.other_fields.imminent_dref %}
364+
{% if fr.other_fields.imminent_dref != 'No' %}
365365
<tr>
366366
<td align="left" style="font-weight: bold" width="30%">
367367
Imminent DREF
@@ -379,7 +379,7 @@
379379
{{ fr.other_fields.imminent_dref_amount|floatformat:"1"|intcomma|slice:":-2" }} </td>
380380
</tr>
381381
{% endif %}
382-
{% if fr.other_fields.eru_base_camp %}
382+
{% if fr.other_fields.eru_base_camp != 'No' %}
383383
<tr>
384384
<td align="left" style="font-weight: bold">
385385
ERU Base Camp
@@ -397,7 +397,7 @@
397397
{{ fr.other_fields.eru_base_camp_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
398398
</tr>
399399
{% endif %}
400-
{% if fr.other_fields.eru_basic_health_care %}
400+
{% if fr.other_fields.eru_basic_health_care != 'No' %}
401401
<tr>
402402
<td align="left" style="font-weight: bold">
403403
ERU basic health care
@@ -415,7 +415,7 @@
415415
{{ fr.other_fields.eru_basic_health_care_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
416416
</tr>
417417
{% endif %}
418-
{% if fr.other_fields.eru_deployment_hospital %}
418+
{% if fr.other_fields.eru_deployment_hospital != 'No' %}
419419
<tr>
420420
<td align="left" style="font-weight: bold">
421421
ERU deployment Hospital
@@ -433,7 +433,7 @@
433433
{{ fr.other_fields.eru_deployment_hospital_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
434434
</tr>
435435
{% endif %}
436-
{% if fr.other_fields.eru_it_telecom %}
436+
{% if fr.other_fields.eru_it_telecom != 'No' %}
437437
<tr>
438438
<td align="left" style="font-weight: bold">
439439
ERU IT Telecom
@@ -451,7 +451,7 @@
451451
{{ fr.other_fields.eru_it_telecom_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
452452
</tr>
453453
{% endif %}
454-
{% if fr.other_fields.eru_logistics %}
454+
{% if fr.other_fields.eru_logistics != 'No' %}
455455
<tr>
456456
<td align="left" style="font-weight: bold">
457457
ERU Logistics
@@ -469,7 +469,7 @@
469469
{{ fr.other_fields.eru_logistics_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
470470
</tr>
471471
{% endif %}
472-
{% if fr.other_fields.eru_referral_hospital %}
472+
{% if fr.other_fields.eru_referral_hospital != 'No' %}
473473
<tr>
474474
<td align="left" style="font-weight: bold">
475475
ERU referral Hospital
@@ -487,7 +487,7 @@
487487
{{ fr.other_fields.eru_referral_hospital_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
488488
</tr>
489489
{% endif %}
490-
{% if fr.other_fields.eru_relief %}
490+
{% if fr.other_fields.eru_relief != 'No' %}
491491
<tr>
492492
<td align="left" style="font-weight: bold">
493493
ERU Relief
@@ -505,7 +505,7 @@
505505
{{ fr.other_fields.eru_relief_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
506506
</tr>
507507
{% endif %}
508-
{% if fr.other_fields.eru_water_sanitation_15 %}
508+
{% if fr.other_fields.eru_water_sanitation_15 != 'No' %}
509509
<tr>
510510
<td align="left" style="font-weight: bold">
511511
ERU water sanitation 15:
@@ -523,7 +523,7 @@
523523
{{ fr.other_fields.eru_water_sanitation_15_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
524524
</tr>
525525
{% endif %}
526-
{% if fr.other_fields.eru_water_sanitation_20 %}
526+
{% if fr.other_fields.eru_water_sanitation_20 != 'No' %}
527527
<tr>
528528
<td align="left" style="font-weight: bold">
529529
ERU water sanitation 20
@@ -541,7 +541,7 @@
541541
{{ fr.other_fields.eru_water_sanitation_20_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
542542
</tr>
543543
{% endif %}
544-
{% if fr.other_fields.eru_water_sanitation_40 %}
544+
{% if fr.other_fields.eru_water_sanitation_40 != 'No' %}
545545
<tr>
546546
<td align="left" style="font-weight: bold">
547547
ERU water sanitation 40
@@ -559,7 +559,7 @@
559559
{{ fr.other_fields.eru_water_sanitation_40_units|floatformat:"1"|intcomma|slice:":-2" }} </td>
560560
</tr>
561561
{% endif %}
562-
{% if fr.other_fields.forecast_based_action %}
562+
{% if fr.other_fields.forecast_based_action != 'No' %}
563563
<tr>
564564
<td align="left" style="font-weight: bold">
565565
Forecast Based Action

0 commit comments

Comments
 (0)