There has been quite a discussion on the ticket regarding this Refs. : https://code.djangoproject.com/ticket/22268 I think we must discuss and decide what should be the solution we should be working towards. Until now there have been two strategies:
1.) The query generated is correct therefore, We just add pk to the query and then when final result is obtained we can club the dicts/tuples having same pk and remove pk. And also remove the ones where the pk is None (due to the LEFT OUTER JOIN). 2.) Instead of retrieving the M2M or reverse foreign key values in the same SQL query, use a clever combination of: - prefetch_related() - subclassing dict and tuple So values() and values_list return these subclassed dicts and tuples, which lazily construct and return the relevant M2M or reverse foreign key elements when they are accessed.In the end, the subclassed dict and tuplewould work somewhat like the Django model, except that you access things in the form of dictionaries and tuples, and you limit the elements that can appear in them. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/4c1b12a4-822a-4582-8d57-3a8f04f62a58%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
