{% load i18n menu_tags cache %}

{% for child in children %}
    <li class="nav-item {% if child.ancestor %}ancestor{% endif %}
        {% if child.selected %} active{% endif %}
        {% if child.children %} dropdown{% endif %}">
        {% if child.children %}
            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                {{ child.get_menu_title }}
            </a>
            <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                {% show_menu from_level to_level extra_inactive extra_active template "" "" child %}
            </ul>
        {% else %}
            <a class="nav-link" href="{{ child.get_absolute_url }}">{{ child.get_menu_title }}</a>
        {% endif %}
    </li>
    {% if class and forloop.last and not forloop.parentloop %}{% endif %}
{% endfor %}
