https://github.com/davidar/django-recurse
Git mirror of the recurse template tag by Lucas Murray
https://github.com/davidar/django-recurse
Last synced: about 1 year ago
JSON representation
Git mirror of the recurse template tag by Lucas Murray
- Host: GitHub
- URL: https://github.com/davidar/django-recurse
- Owner: davidar
- License: lgpl-3.0
- Created: 2009-09-25T09:17:41.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2009-09-25T09:31:41.000Z (over 16 years ago)
- Last Synced: 2025-02-09T23:47:59.915Z (over 1 year ago)
- Language: Python
- Homepage: http://www.undefinedfire.com/lab/recursion-django-templates/
- Size: 89.8 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: COPYING
Awesome Lists containing this project
README
This repository is a packaged version of the recurse Django template tag
written by Lucas Murray.
Usage information according to
is replicated below:
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.
Here is an example of how you can implement a category tree using this
template tag. As you can see it’s fairly simple and with a couple of
modifications can be used for just about anything.
{% load recurse %}
... Headers and stuff ...
{% recurse category.category_set.all with categories as category %}
-
{{ category.title }}
{% child %}
{% loop %}
{% endloop %}
{% endrecurse %}
... The rest of the page ...