1
1

use custom template tag to append euro to prices

This commit is contained in:
2020-02-26 00:10:05 +01:00
parent 693b1198e7
commit b22baf261d
3 changed files with 15 additions and 3 deletions

View File

@@ -1,4 +1,5 @@
{% load static %}
{% load custom_tags %}
<!DOCTYPE html>
<html lang="en">
@@ -58,7 +59,7 @@
{% for balance in balance_list %}
<tr>
<td>{{ balance.date|date:"d.m.y" }}</td>
<td>{{ balance.amount }}</td>
<td>{{ balance.amount|euro }}</td>
</tr>
{% endfor %}
</tbody>
@@ -85,7 +86,7 @@
{% for transaction in transaction_list %}
<tr>
<td>{{ transaction.subject }}</td>
<td>{{ transaction.amount }}</td>
<td>{{ transaction.amount|euro }}</td>
<td>{{ transaction.booking_date|date:"d.m.y" }}</td>
<td>{{ transaction.recurring_months }}</td>
<td>{{ transaction.not_recurring_after|date:"d.m.y" }}</td>
@@ -114,7 +115,7 @@
<tr>
<td>{{ date|date:"d.m.y" }}</td>
<td>{{ subject }}</td>
<td>{{ amount }}</td>
<td>{{ amount|euro }}</td>
</tr>
{% endfor %}
</tbody>

View File

View File

@@ -0,0 +1,11 @@
from decimal import Decimal
from django import template
register = template.Library()
@register.filter(name="euro")
def euro(value):
assert isinstance(value, Decimal)
return str(value) + ""