Browse Source

Get money in PDFs to show up properly

pull/170/head
ariannedee 5 years ago
parent
commit
182328d41c
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      edivorce/apps/core/templatetags/format_utils.py

+ 3
- 2
edivorce/apps/core/templatetags/format_utils.py View File

@ -10,7 +10,7 @@ from django.utils.html import format_html
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.timesince import timesince from django.utils.timesince import timesince
locale.setlocale(locale.LC_ALL, '')
locale.setlocale(locale.LC_ALL, 'en_CA.UTF-8')
register = template.Library() register = template.Library()
@ -123,7 +123,8 @@ def age(date):
@register.filter @register.filter
def money(amount, symbol=True): def money(amount, symbol=True):
""" Return a properly formatted currency string including symbol """ """ Return a properly formatted currency string including symbol """
if not amount:
amount = 0
try: try:
return locale.currency(float(amount), symbol, grouping=True) return locale.currency(float(amount), symbol, grouping=True)
except ValueError: except ValueError:


Loading…
Cancel
Save