G
G
GuguSab2021-05-28 16:08:16
Django
GuguSab, 2021-05-28 16:08:16

When using the dropdown menu to display the django-mptt tree, nesting is not fully displayed. How to make the tree displayed completely?

When using normal recursion to display the tree, everything is displayed fine
60b0e0c78dd29612628245.png

. But I need a drop-down list, and in this case, not full nesting is displayed, but only up to the second level. I don't understand why, please help.
60b0e1dc90ace314796401.png

Here is the code from the template:

{% load mptt_tags %}
    {% recursetree rubrics %}
<ul class="nav">

        <li class="nav-item dropright">
            <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-expanded="false"> {{ node.name }}</a>
            {% if not node.is_leaf_node %}
                <ul class="dropdown-menu">
                    <li><a class="dropdown-item">{{ children }}</a></li>
                </ul>
            {% endif %}


</ul>
    {% endrecursetree %}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question