{# the variables tree_template and tree_items must be defined before entering #} {# tree_items is a list of dicts with properties name, url, children #} {% for child in tree_items %}
  • {% if child.children %} {% if child.url %}{% endif %} {{ child.name }} {% if child.description %}{# show info button if description available #}  
    {% autoescape off %}{{ child.description }}{% endautoescape %}
    {% endif %}
    {% if child.url %}
    {% endif %} {% else %} {# No children: it's a leaf. #} {% if child.url %} {{ child.name }} {% else %} {{ child.name }} {% endif %} {% if child.description %}{# show info button if description available #}  
    {% autoescape off %}{{ child.description }}{% endautoescape %}
    {% endif %} {% endif %}
  • {% endfor %}