{% load menu_tags %}
{% for child in children %}
  {% if child.children %}
    <li class="dropdown {% if child.selected %}active{% endif %}{% if child.ancestor %}active{% endif %}">
      <a class="dropdown-toggle" data-hover="dropdown" data-close-others="true" data-toggle="dropdown" href="{{ child.attr.redirect_url|default:child.get_absolute_url }}">{{ child.get_menu_title }}</a>
      <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
        {% for child in child.children %}
          <li>
            <a href="{{ child.get_absolute_url }}">{{ child.get_menu_title }}</a>
          </li>
        {% endfor %}
      </ul>
    </li>
  {% else %}
    <li class="{% if child.selected %}active{% endif %}{% if child.ancestor %}active{% endif %}">
        <a href="{{ child.attr.redirect_url|default:child.get_absolute_url }}">{{ child.get_menu_title }}</a>
    </li>
  {% endif %}
{% endfor %}
