2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

Added links to child categories

This commit is contained in:
Oliver Walters 2017-03-26 10:23:22 +11:00
parent ef8cfa794f
commit 3f81046a26
2 changed files with 10 additions and 1 deletions

View File

@ -4,6 +4,10 @@
{% endfor %} {% endfor %}
{{ category.name }} {{ category.name }}
<br><br>Children:<br>
{% for child in children %}
<a href="/part/category/{{ child.pk }}">{{ child.name }}</a><br>
{% endfor %} {% endfor %}
<br> <br>

View File

@ -18,5 +18,10 @@ def category(request, category_id):
# Find the category # Find the category
cat = get_object_or_404(PartCategory, pk=category_id) cat = get_object_or_404(PartCategory, pk=category_id)
# Child categories
childs = PartCategory.objects.filter(parent = cat.pk)
return render(request, 'part/category.html', return render(request, 'part/category.html',
{'category': cat}) {'category': cat,
'children': childs
})