{% if teams %}
{% for team in teams %} {% if not team.parent %} {% if team.direct_add %} {% if team.has_subteams %} {% for subteam in team.team_set.all %} {% if subteam.active and subteam.visible_in_list %} {% if subteam.direct_add %}
{% endif %} {% endif %} {% endfor %}
{% else %}

{% endif %} {% endif %} {% endif %} {% endfor %}
{% endif %}