{% load mptt_tags %}
<ul class='nav flex-column mb-2'>
    {% recursetree menu %}
        <li class='nav-item'>
            {% if not node.is_leaf_node %}
            <a class="nav-link collapsed text-truncate" href="#{{ node.name | cut:" "}}" data-toggle="collapse" data-target="#{{node.name | cut:" "}}">
                <span data-feather="{{ node.icon }}"></span>
                {{ node.name }}</a> 

            <div class="collapse show" id="{{ node.name|cut:" " }}" aria-expanded="false">
                <ul class="nav flex-column mb-2">
                    {{ children }}
                </ul>
                    </div>
            {% else %}
            <a href="{{ node.url | safe }}" class='nav-link'>
                <span data-feather="{{ node.icon }}"></span>
                {{ node.name }}</a>
            {% endif %}
        </li>
    {% endrecursetree %}
</ul>

