Hi, I searched everything and can not find the answer to this question. I only have 3 months experience using python / django, so sorry my dummy question! Im using django mptt to display a simple nested set navigation.
<ul class="root"> {% recursetree nodes %} <li> {{ node.name }} {% if not node.is_leaf_node %} <ul class="children"> {{ children }} </ul> {% endif %} </li> {% endrecursetree %}
this works fine, however I would like to show only children of the selected category (based on slug), and not all of them. Any ideas???
i finally did it like this:
{% recursetree nodes %} <li> <a href='/{{ node.get_absolute_url}}'>{{ node.name }}</a> </li> {% if not node.is_leaf.node %} {% for c in child %} {% if c in node.get_children %} {% if forloop.first %} <ul class="children"> {{ children }} </ul> {% endif %} {% endif %} {% endfor %} {% endif %} {% endrecursetree %}
in submissions
category = get_object_or_404(Category, slug=slug) child = category.get_children() if not child : child = category.get_siblings()
but it's a hack. who has an idea?
zzart source share