1👍
If you pass:
menus = Menu.objects.all()
you can use in your template:
{% for menu in menus %}
...
{% if menu.sub_menu.exists %}
{% for submenu in menu.sub_menu.all %}
....
You did already call .all()
in your view.
Source:stackexchange.com