Add category page

This commit is contained in:
Edgar P. Burkhart 2022-05-20 19:17:42 +02:00
parent df49afb5a4
commit 467c8002e2
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
6 changed files with 84 additions and 22 deletions

View file

@ -0,0 +1,20 @@
{% extends "main/base.html" %}
{% block body %}
<a href="{% url 'index' %}">Home</a>
<h1>{{ category.tree|join:" → " }}</h1>
<form action="{% url 'update_category' category.id %}" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" />
</form>
{% if transactions %}
<h2>Transactions ({{ transactions|length }})</h2>
<ul>
{{ transactions|unordered_list }}
</ul>
{% endif %}
{% endblock %}

View file

@ -37,7 +37,13 @@
{% if categories %}
<ul id="categories">
{{ categories|unordered_list }}
{% for cat in categories %}
<li class="{% if cat.tree|length > 3 %}cat4{% else %}cat{{ cat.tree|length }}{% endif %}">
<a href="{% url 'category' cat.id %}">
{% if cat.tree|length > 3 %}{{ cat.tree|slice:"3:"|join:" → " }}{% else %}{{ cat.name }}{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endif %}