Answer the question
In order to leave comments, you need to log in
Django-mptt. How to draw children from a specific element ID?
Good evening. The examples say:
views.py
def show_genres(request):
return render(request, "genres.html", {'genres': Genre.objects.all()})
{% load mptt_tags %}
<ul>
{% recursetree genres %}
<li>
{{ node.name }}
{% if not node.is_leaf_node %}
<ul class="children">
{{ children }}
</ul>
{% endif %}
</li>
{% endrecursetree %}
</ul>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question