From d4b40b1967b99aaf8ac328e75982d56b0ece210d Mon Sep 17 00:00:00 2001 From: Timotheus Pokorra Date: Sat, 6 Sep 2025 09:46:42 +0200 Subject: [PATCH] avoid warning: 'filter' is used for multiple template tag modules: 'apps.monitor.templatetags.filter', 'apps.transactions.templatetags.filter' --- apps/monitor/templates/monitor.html | 24 +++++++++---------- .../{filter.py => monitor_filter.py} | 2 +- apps/transactions/templates/show.html | 8 +++---- .../{filter.py => transaction_filter.py} | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) rename apps/monitor/templatetags/{filter.py => monitor_filter.py} (90%) rename apps/transactions/templatetags/{filter.py => transaction_filter.py} (87%) diff --git a/apps/monitor/templates/monitor.html b/apps/monitor/templates/monitor.html index 45cecb8..d8d0e7b 100644 --- a/apps/monitor/templates/monitor.html +++ b/apps/monitor/templates/monitor.html @@ -1,5 +1,5 @@ {% extends 'base.html' %} -{% load filter %} +{% load monitor_filter %} {% block content %}
@@ -17,8 +17,8 @@
@@ -67,13 +67,13 @@ We have sold {{ c.crypto }} for {{ c.sold|floatformat:2 }} EUR
{% endif %} {% if c.amount_kept %} - Current value of our {{ c.amount_kept|formatcurrency }} {{ c.crypto }} is {{ c.current_value|floatformat:2 }} EUR
+ Current value of our {{ c.amount_kept|monitorformatcurrency }} {{ c.crypto }} is {{ c.current_value|floatformat:2 }} EUR
{% endif %} {% if c.bought_recently %} - We have bought within the last 12 months: {{ c.bought_recently|formatcurrency }} {{ c.crypto }}
+ We have bought within the last 12 months: {{ c.bought_recently|monitorformatcurrency }} {{ c.crypto }}
{% endif %} {% if c.bought_tax_free %} - We can sell without paying taxes: {{ c.bought_tax_free|formatcurrency }} {{ c.crypto }} for {{ c.value_tax_free|floatformat:2 }} EUR
+ We can sell without paying taxes: {{ c.bought_tax_free|monitorformatcurrency }} {{ c.crypto }} for {{ c.value_tax_free|floatformat:2 }} EUR
{% endif %}
My transactions
@@ -93,7 +93,7 @@ {{ r.dateRelative }} {{ r.date|date:'Y-m-d' }} - {{ r.rateEUR|formatcurrency }} EUR/{{ c.crypto }} + {{ r.rateEUR|monitorformatcurrency }} EUR/{{ c.crypto }} {% if r.diffPercentage %} {{ r.diffPercentage|floatformat:1 }}% {% endif %} @@ -107,11 +107,11 @@

{{ g.label }}


- Start: {{ g.startdate }} {{ g.startvalue|formatcurrency }} EUR
- Now: {{ g.curdate }} {{ g.curvalue|formatcurrency }} EUR
+ Start: {{ g.startdate }} {{ g.startvalue|monitorformatcurrency }} EUR
+ Now: {{ g.curdate }} {{ g.curvalue|monitorformatcurrency }} EUR
Diff: {{ g.diffPercentage|floatformat:1 }} %
- Min: {{ g.mindate }} {{ g.minvalue|formatcurrency }} EUR
- Max: {{ g.maxdate }} {{ g.maxvalue|formatcurrency }} EUR
+ Min: {{ g.mindate }} {{ g.minvalue|monitorformatcurrency }} EUR
+ Max: {{ g.maxdate }} {{ g.maxvalue|monitorformatcurrency }} EUR
{% endfor %}
@@ -124,7 +124,7 @@
    diff --git a/apps/monitor/templatetags/filter.py b/apps/monitor/templatetags/monitor_filter.py similarity index 90% rename from apps/monitor/templatetags/filter.py rename to apps/monitor/templatetags/monitor_filter.py index e882f68..adefd74 100644 --- a/apps/monitor/templatetags/filter.py +++ b/apps/monitor/templatetags/monitor_filter.py @@ -3,7 +3,7 @@ from django import template register = template.Library() @register.filter -def formatcurrency(value): +def monitorformatcurrency(value): if not value: return "0.00" if value > 100: diff --git a/apps/transactions/templates/show.html b/apps/transactions/templates/show.html index ae23840..948a957 100644 --- a/apps/transactions/templates/show.html +++ b/apps/transactions/templates/show.html @@ -1,6 +1,6 @@ {% extends 'base.html' %} {% load humanize %} -{% load filter %} +{% load transaction_filter %} {% block content %}
    @@ -35,16 +35,16 @@ - {{ transaction.fiat_total|formatcurrency }} + {{ transaction.fiat_total|transactionformatcurrency }} {{ transaction.fiat_currency }} {% if transaction.transaction_type == 'S' %} - {{ transaction.exchange_rate|formatcurrency }} {{ transaction.crypto_currency }}/{{ transaction.fiat_currency }} + {{ transaction.exchange_rate|transactionformatcurrency }} {{ transaction.crypto_currency }}/{{ transaction.fiat_currency }} {% endif %} {% if transaction.transaction_type == 'B' %} - {{ transaction.exchange_rate|formatcurrency }} {{ transaction.crypto_currency }}/{{ transaction.fiat_currency }} + {{ transaction.exchange_rate|transactionformatcurrency }} {{ transaction.crypto_currency }}/{{ transaction.fiat_currency }} {% endif %} diff --git a/apps/transactions/templatetags/filter.py b/apps/transactions/templatetags/transaction_filter.py similarity index 87% rename from apps/transactions/templatetags/filter.py rename to apps/transactions/templatetags/transaction_filter.py index 8c70706..5481dad 100644 --- a/apps/transactions/templatetags/filter.py +++ b/apps/transactions/templatetags/transaction_filter.py @@ -3,7 +3,7 @@ from django import template register = template.Library() @register.filter -def formatcurrency(value): +def transactionformatcurrency(value): if value > 100: return "%0.0f" % (value,) if value < 0.01: