From 59c05b95d098b6718531e01fd3f745e784c28d66 Mon Sep 17 00:00:00 2001
From: Aakash Singh
Date: Sat, 1 Jun 2024 17:25:24 +0530
Subject: [PATCH] Fix discharge summary filters (#2210)
---
care/facility/templatetags/filters.py | 3 ++-
care/templates/reports/patient_discharge_summary_pdf.html | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
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}}