@@ -479,11 +479,11 @@ def construct_template_record(self, rtype, record):
479479 'gov_assistance' : 'Yes' if record .request_assistance else 'No' ,
480480 'ns_assistance' : 'Yes' if record .ns_request_assistance else 'No' ,
481481 'dtype_id' : record .dtype_id ,
482- 'visibility' : record .visibility ,
482+ 'visibility' : record .get_visibility_display () ,
483483 'other_fields' : {
484- 'appeal' : record .appeal ,
484+ '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,
@@ -727,7 +727,7 @@ def notify(self, records, rtype, stype, uid=None):
727727 # Handle Visibility for Field Reports
728728 if rtype == RecordType .FIELD_REPORT :
729729 rtype_of_subscr , stype = self .fix_types_for_subs (rtype , stype )
730- non_ifrc_records = [rec for rec in record_entries if int ( rec ['visibility' ]) != 2 ]
730+ non_ifrc_records = [rec for rec in record_entries if rec ['visibility' ] != 'IFRC Only' ]
731731 if non_ifrc_records :
732732 non_ifrc_filters = (Q (subscription__rtype = rtype_of_subscr ) &
733733 Q (subscription__stype = stype ) &
0 commit comments