Adding currency tags to display prices correct

This commit is contained in:
Víðir Valberg Guðmundsson 2016-05-16 20:56:52 +02:00
parent 1fb5454590
commit 029ca1cf00
4 changed files with 17 additions and 5 deletions

View file

@ -1,5 +1,6 @@
{% extends 'base.html' %}
{% load bootstrap3 %}
{% load shop_tags %}
{% block content %}
@ -42,9 +43,9 @@
{{ order_product.quantity }}
{% endif %}
<td>
{{ order_product.product.price }}
{{ order_product.product.price|currency }}
<td>
{{ order_product.total }}
{{ order_product.total|currency }}
{% endfor %}
@ -53,14 +54,14 @@
<td>
<strong>Hereof VAT (25%)</strong>
<td>
{{ order.vat }}
{{ order.vat|currency }}
<tr>
<td colspan="2">
<td>
<strong>Total</strong>
<td>
{{ order.total }}
{{ order.total|currency }}
</table>

View file

@ -1,5 +1,6 @@
{% extends 'base.html' %}
{% load bootstrap3 %}
{% load shop_tags %}
{% block content %}
@ -33,7 +34,7 @@
</h4>
<h4>
Price: {{ product.price }} DKK
Price: {{ product.price|currency }}
</h4>
<p>

View file

View file

@ -0,0 +1,10 @@
from django import template
register = template.Library()
@register.filter
def currency(value):
return "{0:.2f} DKK".format(value)