Template source: _city_category_dropdown.html

{% load mptt_tags %} {% recursetree category.get_children %} {% if children %} <li class="menu-left dropdown"> <a href="{% url 'category_single' category.slug %}" id="dropdownMenu1" aria-haspopup="true" aria-expanded="true"> {{ category }} <i class="fa fa-angle-down"></i> </a> <ul class="dropdown-menu" aria-labelledby="dropdownMenu1"> {% for sub_category in children %} <li><a href="{% url 'category_single' sub_category.slug %}">{{ sub_category.title }}</a></li> {% endfor %} </ul> </li> {% endif %} {% endrecursetree %}