Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add category template tag
Michal Ociepka3b260826f089
diff --git a/product/templates/category/_list.html b/product/templates/category/_list.htmlnew file mode 100644index 0000000000..d904a2e431--- /dev/null+++ b/product/templates/category/_list.html@@ -0,0 +1,12 @@+{% load mptt_tags %}++{% recursetree categories %}+ <li>+ <a href="{{ node.get_absolute_url }}">{{ node }}</a>+ {% if not node.is_leaf_node %}+ <ul class="children">+ {{ children }}+ </ul>+ {% endif %}+ </li>+{% endrecursetree %}diff --git a/product/templatetags/__init__.py b/product/templatetags/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/product/templatetags/category.py b/product/templatetags/category.pynew file mode 100644index 0000000000..999c0ae2ef--- /dev/null+++ b/product/templatetags/category.py@@ -0,0 +1,9 @@+from django import template+from product.models import Category++register = template.Library()++[email protected]_tag('category/_list.html')+def categories_list():+ return {'categories': Category.objects.all()}