python - How to perform a "Group By" query in Django 1.1? -
I've seen a lot about the consolidation of 1.1, but I'm not sure that it's easy to use How To By Group
I am trying to use Zenzo's Sitemap Framework to create a Sitemap.xml file that allows Google to crawl all the pages of my site to search. Currently I am passing it on all the items, such as Model.objects.all ()
- although in fact in all cases only 1 per name is passed with the same name as 5 -10 models can be examples, but I want to give one to avoid only one duplicate.
If I do something like this:
Model Anatet (count ('name'))
It gives me that What do I want, but then I'm not retrieving all the fields from the model - the code creates the code that will be forced to query again for each model to create a link to the sitemap. So when I retrieve all the areas of the model, how do I get it in group by name?
Django models are lazy loaded. If your code runs in your model relationships such as a sitemap, then it will be the same amount of overhead unless the model fields are essentially a proxy until you request related models.
Comments
Post a Comment