diff --git a/care/facility/templatetags/filters.py b/care/facility/templatetags/filters.py index 9a8bc576fa..045819279c 100644 --- a/care/facility/templatetags/filters.py +++ b/care/facility/templatetags/filters.py @@ -22,7 +22,8 @@ def suggestion_string(suggestion_code: str): @register.filter() def field_name_to_label(value): - return value.replace("_", " ").capitalize() + if value: + return value.replace("_", " ").capitalize() @register.filter(expects_localtime=True) diff --git a/care/templates/reports/patient_discharge_summary_pdf.html b/care/templates/reports/patient_discharge_summary_pdf.html index b5b1594b64..2a2125c788 100644 --- a/care/templates/reports/patient_discharge_summary_pdf.html +++ b/care/templates/reports/patient_discharge_summary_pdf.html @@ -67,7 +67,7 @@

Address: {{patient.address}}

- Ration Card Category: {{patient.get_ration_card_category_display|field_name_to_label}} + Ration Card Category: {{patient.get_ration_card_category_display}}