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

View file

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