>From a glance at your code looks it looks like the cat reference is not being updated to the sub category and is just endlessly looping over the top level category
something more along these lines may help (where 'do_menu' is an inclusion tag) http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags {% for child in children %} <li> {% if not child.is_leaf_node %}{% endif %} <a href="{{ child.get_absolute_url }}" >{{ child.get_title }}</a> {% if child.childrens %} <ul> {% do_menu "menu.html" child %} </ul> {% endif %} </li> {% endfor %} On Sep 14, 9:25 pm, xyz69 <pawelszc...@gmail.com> wrote: > Hello, > > I have "Category" app. I use django-mptt to remember the structure od > the category tree. > I want to show this tree in nested list using generic view > (render_to_template). > I pass a category_list in extra_context and the problem starts when > want to show it. > I try something like this: > > # category_list.html > <ul> > {% for cat in object_list %} > {% if not cat.parent %} > <li>{{cat.name}}</li> > {% if cat.children.all %} > {% include "category_list_helper.html" %} > has children > {% endif %} > {% endif%} > {% endfor %} > </ul> > > # category_list_helper > <ul> > {% for cat in cat.children.all %} > <li>{{cat.name}} > {% if cat.children.all %} > {% include "category_list_helper.html"%} > {% endif %} > </li> > {% endfor %} > </ul> > > So... if there is only one level of recursion, everything is ok, > but when I have subsubcategories, error happens;) > > "RuntimeError at /blog/categories/ > maximum recursion depth exceeded while calling a Python object" > > I also google for solution, and > this:http://www.undefinedfire.com/lab/recursion-django-templates/ > looks sensibly. > > What do you think? > Have you ever had similar problem? > > Pawel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---