From da5b0f0f2629178842dd2cc753444bcc395e4b27 Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Mon, 30 May 2016 18:18:31 +0200 Subject: [PATCH] convert to int(), wrap in try/except --- shop/templatetags/shop_tags.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shop/templatetags/shop_tags.py b/shop/templatetags/shop_tags.py index 48316a98..189f1b26 100644 --- a/shop/templatetags/shop_tags.py +++ b/shop/templatetags/shop_tags.py @@ -6,7 +6,10 @@ register = template.Library() @register.filter def currency(value): - return "{0:.2f} DKK".format(value) + try: + return "{0:.2f} DKK".format(int(value)) + except ValueError: + return False @register.filter()