Re: Displaying Categories / Subcategories (Tango with Django Example)

2017-05-12 Thread jorrit787
Both, actually. The OP is looping through his cats and pages querysets multiple times unnecessarily. That can get very inefficient as those database tables get bigger. On Friday, May 12, 2017 at 6:04:01 PM UTC+2, sacrac wrote: > > {% regroup %} is elegantly or more optimized??? > > On Fri, May

Re: Displaying Categories / Subcategories (Tango with Django Example)

2017-05-12 Thread carlos
{% regroup %} is elegantly or more optimized??? On Fri, May 12, 2017 at 5:05 AM, wrote: > You can look into the {% regroup %} template tag. It will do what you are > trying to do more elegantly. > > > > On Wednesday, May 10, 2017 at 7:40:26 PM UTC+2, Michael Smith wrote: >> >> I'm following the

Re: Displaying Categories / Subcategories (Tango with Django Example)

2017-05-12 Thread jorrit787
You can look into the {% regroup %} template tag. It will do what you are trying to do more elegantly. On Wednesday, May 10, 2017 at 7:40:26 PM UTC+2, Michael Smith wrote: > > I'm following the latest Tango book and was experimenting with different > ways of looping through categories and subca

Displaying Categories / Subcategories (Tango with Django Example)

2017-05-10 Thread Michael Smith
I'm following the latest Tango book and was experimenting with different ways of looping through categories and subcategories to create a list. I have a 'Category' and 'Page' model, where Page has a foreign key to Category's ID. To display a list with sub-bullets I simply passed all categorie