# Django template nested loop

**URL:** <https://forum.djangoproject.com/t/django-template-nested-loop/11377>\
**Category:** Using the ORM\
**Created:** [January 4, 2022, 4:46pm UTC](https://forum.djangoproject.com/t/django-template-nested-loop/11377 "2022-01-04T16:46:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [January 4, 2022, 5:23pm UTC](https://forum.djangoproject.com/t/django-template-nested-loop/11377/2 "2022-01-04T17:23:43Z")

</div>

Yes it is possible.

However, there’s a lot more to this topic. If you’re working with any kind of tree structure implemented in a relational database, you will want to consider a more robust implementation of your models.

At a minimum, you’ll want to look at django-treebeard, django-mptt, and django-treenode.

Also see the texts and links at:

- [Django-mptt or treebeard for reddit-like comments?](https://forum.djangoproject.com/t/django-mptt-or-treebeard-for-reddit-like-comments/2030)
- [Some modelling advice - #12 by KenWhitesell](https://forum.djangoproject.com/t/some-modelling-advice/3284/12)
- [tree traversal in template or view?](https://forum.djangoproject.com/t/tree-traversal-in-template-or-view/3473)
- [Multi-level access with ManyToMany relationships in Django](https://forum.djangoproject.com/t/multi-level-access-with-manytomany-relationships-in-django/10783)

---

_[View the full topic](https://forum.djangoproject.com/t/django-template-nested-loop/11377)._
