Hello. I'm new to both django and python. Been trying to figure out how to group items from a model for hours now.
Another approach would be to build a list of dictionaries based on the query and pass this to the template instead of the pure llst of books:
[{
publisher: 'Publisher X',
books: ['Book A', 'Book B']
}],....
So the logic remains in the code and not in the template.
Kai
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/40de5ec2-c4d1-4cf2-8e4e-766dea21460b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.