how do i implement the tree structure in django templates with out using django-mptt.
i have model.
class Person(TimeStampedModel):
name = models.Ch
from Django while loop question and
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags
# view.py
@register.inclusion_tag('children.html')
def children_tag(person):
children = person.children.all()
return {'children': children}
# children.html
{% for child in children %}
- {{ child }}
{% if child.children.count > 0 %}
{% children_list child %}
{% endif %}
{% endfor %}
# your template
{% children_tag parent %}