use custom template tag to append euro to prices
This commit is contained in:
@@ -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>
|
||||
|
||||
0
financeplanner/templatetags/__init__.py
Normal file
0
financeplanner/templatetags/__init__.py
Normal file
11
financeplanner/templatetags/custom_tags.py
Normal file
11
financeplanner/templatetags/custom_tags.py
Normal 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) + "€"
|
||||
Reference in New Issue
Block a user