From 182328d41cbc0c0428a7e15e9686afaa796dd487 Mon Sep 17 00:00:00 2001 From: ariannedee Date: Mon, 14 Sep 2020 12:09:19 -0700 Subject: [PATCH] Get money in PDFs to show up properly --- edivorce/apps/core/templatetags/format_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/edivorce/apps/core/templatetags/format_utils.py b/edivorce/apps/core/templatetags/format_utils.py index 432d310f..5e297331 100644 --- a/edivorce/apps/core/templatetags/format_utils.py +++ b/edivorce/apps/core/templatetags/format_utils.py @@ -10,7 +10,7 @@ from django.utils.html import format_html from django.utils.safestring import mark_safe from django.utils.timesince import timesince -locale.setlocale(locale.LC_ALL, '') +locale.setlocale(locale.LC_ALL, 'en_CA.UTF-8') register = template.Library() @@ -123,7 +123,8 @@ def age(date): @register.filter def money(amount, symbol=True): """ Return a properly formatted currency string including symbol """ - + if not amount: + amount = 0 try: return locale.currency(float(amount), symbol, grouping=True) except ValueError: