From 3f81046a26d54124efc69ca37b3bdc7c780ecd06 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 26 Mar 2017 10:23:22 +1100 Subject: [PATCH] Added links to child categories --- InvenTree/part/templates/part/category.html | 4 ++++ InvenTree/part/views.py | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/templates/part/category.html b/InvenTree/part/templates/part/category.html index 1497d3dc35..481073fb6a 100644 --- a/InvenTree/part/templates/part/category.html +++ b/InvenTree/part/templates/part/category.html @@ -4,6 +4,10 @@ {% endfor %} {{ category.name }} + +

Children:
+{% for child in children %} +{{ child.name }}
{% endfor %}
diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 3750612d1b..7e11750500 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -18,5 +18,10 @@ def category(request, category_id): # Find the category cat = get_object_or_404(PartCategory, pk=category_id) + # Child categories + childs = PartCategory.objects.filter(parent = cat.pk) + return render(request, 'part/category.html', - {'category': cat}) \ No newline at end of file + {'category': cat, + 'children': childs + }) \ No newline at end of file