diff --git a/apps/monitor/templates/monitor.html b/apps/monitor/templates/monitor.html index 460123a..e00d961 100644 --- a/apps/monitor/templates/monitor.html +++ b/apps/monitor/templates/monitor.html @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% load filter %} {% block content %}
@@ -16,8 +17,8 @@
@@ -88,7 +89,7 @@ {{ r.dateRelative }} {{ r.date|date:'Y-m-d' }} - {{ r.rateEUR|floatformat:0 }} EUR/{{ c.crypto }} + {{ r.rateEUR|formatcurrency }} EUR/{{ c.crypto }} {% if r.diffPercentage %} {{ r.diffPercentage|floatformat:1 }}% {% endif %} @@ -102,11 +103,11 @@

{{ g.label }}


- Start: {{ g.startdate }} {{ g.startvalue|floatformat:0 }} EUR
- Now: {{ g.curdate }} {{ g.curvalue|floatformat:0 }} EUR
+ Start: {{ g.startdate }} {{ g.startvalue|formatcurrency }} EUR
+ Now: {{ g.curdate }} {{ g.curvalue|formatcurrency }} EUR
Diff: {{ g.diffPercentage|floatformat:1 }} %
- Min: {{ g.mindate }} {{ g.minvalue|floatformat:0 }} EUR
- Max: {{ g.maxdate }} {{ g.maxvalue|floatformat:0 }} EUR
+ Min: {{ g.mindate }} {{ g.minvalue|formatcurrency }} EUR
+ Max: {{ g.maxdate }} {{ g.maxvalue|formatcurrency }} EUR
{% endfor %}
diff --git a/apps/monitor/templatetags/__init__.py b/apps/monitor/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/apps/monitor/templatetags/filter.py b/apps/monitor/templatetags/filter.py new file mode 100644 index 0000000..e556ed3 --- /dev/null +++ b/apps/monitor/templatetags/filter.py @@ -0,0 +1,10 @@ +from django import template + +register = template.Library() + +@register.filter +def formatcurrency(value): + if value > 100: + return "%0.0f" % (value,) + return "%0.2f" % (value,) +