money template filter: coerce None to 0.00

This commit is contained in:
Raphael Michel
2021-10-26 18:07:37 +02:00
parent 69cf62d2ca
commit 93263e7567

View File

@@ -34,6 +34,8 @@ register = template.Library()
def money_filter(value: Decimal, arg='', hide_currency=False):
if isinstance(value, (float, int)):
value = Decimal(value)
if value is None:
value = Decimal('0.00')
if not isinstance(value, Decimal):
if value == '':
return value