{% load mptt_tags %}

<ul class="category-tree">
    {% recursetree categories %}
        <li>
            {% if node.is_leaf_node %}
                <a class="category-tree-leaf" href="{{ node.get_absolute_url }}">
                    <span class="glyphicon glyphicon-folder-close" aria-hidden="true"> </span> {{ node.name }}
                </a>
            {% else %}
                <a class="category-tree-parent" href="{{ node.get_absolute_url }}">
                    <span class="glyphicon glyphicon-folder-open" aria-hidden="true"> </span> {{ node.name }}
                </a>
                <ul class="children">
                    {{ children }}
                </ul>
            {% endif %}
        </li>
    {% endrecursetree %}
</ul>
