Add category page
This commit is contained in:
parent
df49afb5a4
commit
467c8002e2
6 changed files with 84 additions and 22 deletions
20
nummi/main/templates/main/category.html
Normal file
20
nummi/main/templates/main/category.html
Normal 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 %}
|
|
@ -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 %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue