Add links to category in year category plot

This commit is contained in:
Edgar P. Burkhart 2024-01-02 11:59:44 +01:00
parent 309281f5e1
commit 8b9af8e1a4
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 9 additions and 2 deletions

View file

@ -24,6 +24,8 @@
{% if cat.category %} {% if cat.category %}
{% if month %} {% if month %}
<a href="{% url "category_transaction_month" cat.category month.year month.month %}">{{ cat.category__name }}</a> <a href="{% url "category_transaction_month" cat.category month.year month.month %}">{{ cat.category__name }}</a>
{% elif year %}
<a href="{% url "category_transaction_year" cat.category year.year %}">{{ cat.category__name }}</a>
{% else %} {% else %}
{{ cat.category__name }} {{ cat.category__name }}
{% endif %} {% endif %}

View file

@ -1,5 +1,5 @@
from django.urls import path from django.urls import path
from transaction.views import TransactionMonthView from transaction.views import TransactionMonthView, TransactionYearView
from . import views from . import views
@ -12,6 +12,11 @@ urlpatterns = [
name="category_transactions", name="category_transactions",
), ),
path("<category>/delete", views.CategoryDeleteView.as_view(), name="del_category"), path("<category>/delete", views.CategoryDeleteView.as_view(), name="del_category"),
path(
"<category>/history/<int:year>",
TransactionYearView.as_view(),
name="category_transaction_year",
),
path( path(
"<category>/history/<int:year>/<int:month>", "<category>/history/<int:year>/<int:month>",
TransactionMonthView.as_view(), TransactionMonthView.as_view(),

View file

@ -17,6 +17,6 @@
{% endif %} {% endif %}
{% if not category %} {% if not category %}
<h3>{% translate "Categories" %}</h3> <h3>{% translate "Categories" %}</h3>
{% category_plot transactions month=month %} {% category_plot transactions year=year %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}