From b6da2dbc66b084cf04124878f9f3617be1cff5bf Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 12 Sep 2013 18:54:28 +0200 Subject: Change m2 to ha in dashboards (refs #559) --- ishtar_common/templatetags/units.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 ishtar_common/templatetags/units.py (limited to 'ishtar_common') diff --git a/ishtar_common/templatetags/units.py b/ishtar_common/templatetags/units.py new file mode 100644 index 000000000..d4d755265 --- /dev/null +++ b/ishtar_common/templatetags/units.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from django.template import Library + +register = Library() + +@register.filter +def m2_to_ha(value): + try: + value = float(value)/10000 + except: + return "" + return "%.2f" % round(value, 2) + -- cgit v1.2.3