Recurse template tag for Django
[Original and further information available from here.](http://www.undefinedfire.com/articles/recursion-in-django-templates/) **v1.1 Update (20/04/08):** Added the ability to recurse single elements as well as automatic skipping of empty elements. Most of the tags are self explanatory, the only one that may cause confusion is the main `{% recurse %}` one. The format for this tag is `{% recurse [children] with [parent] as [child] %}` where “[children]” is the property that contains the children of the current element, “[parent]” is your starting element and “[child]” is the variable named used in the loop. Example usage: {% load recurse %} ... Headers and stuff ... {% recurse category.category_set.all with categories as category %} <ul> {% loop %} <li> <h{{ level }}>{{ category.title }}</h{{ level }}> {% child %} </li> {% endloop %} </ul> {% endrecurse %} ... The rest of the page ...
- template
- templatetag
- recursion