#6701: in qs-rf when many to many field referenced in order_by(), count() 
doesn't
match length of queryset
---------------------------------+------------------------------------------
   Reporter:  [EMAIL PROTECTED]    |                Owner:  nobody       
     Status:  closed             |            Component:  Uncategorized
    Version:  queryset-refactor  |           Resolution:  wontfix      
   Keywords:  qs-rf              |                Stage:  Unreviewed   
  Has_patch:  0                  |           Needs_docs:  0            
Needs_tests:  0                  |   Needs_better_patch:  0            
---------------------------------+------------------------------------------
Comment (by [EMAIL PROTECTED]):

 My post on django-users http://groups.google.com/group/django-
 users/browse_thread/thread/6acd66bcd9d21de2 perhaps helps show what I'm
 trying to do. It is useful to order on an m2m IF in the result set you can
 see what m2m related items correspond to the entries in the result set.

 As for not fixing it - if I'd suggest perhaps a note on the documentation
 then so anyone who, in the future, uses the fact that you CAN specify m2ms
 in the order_by doesn't get baffled by the count() being wrong sometimes
 and right sometimes (depending on whether the result cache is populated
 yet or not). Although I guess the alternative if you believe it doesn't
 make sense (I still disagree on that one - see my use case in the thread)
 is to just remove m2m from order_by and document it.

 To give an example of the count inconsistency, set up a query_set with an
 m2m on the order by and multiples and do the following:
 first_count = test_set.count()
 second_count = len(test_set)
 third_count = test_set.count()

 And you could get, e.g., first_count being 5, second_count being 6 and
 then third_count being 6 because of "if self._result_cache is not None:
 return len(self._result_cache)"

-- 
Ticket URL: <http://code.djangoproject.com/ticket/6701#comment:2>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to