Re: Ordering over ManyToMany relationship omits records

2009-11-27 Thread Ramiro Morales
On Thu, Nov 26, 2009 at 6:31 PM, David wrote: > > >>> Listing.objects.order_by("book__courses") > > gives me Listings with id's (5, 1, 3, 5, 2, 4), and > > >>> Listing.objects.order_by("-book__courses") > > gives me Listings with id's (6, 4, 5, 2, 5,1) On Thu, Nov 26, 2009 at 6:38 PM, David wrot

Re: Ordering over ManyToMany relationship omits records

2009-11-26 Thread David
P.S. id == 6 disappears in ascending and id == 3 disappears in descending. It's not a surprise that id == 5 is duplicated because it is the only Listing__book which has a relationship with two courses, the rest have a relationship with only one. That part does look suspicious to me though, as if t

Ordering over ManyToMany relationship omits records

2009-11-26 Thread David
When I order over a ManyToMany relationship, certain records will not appear. The record which disappears changes depending on the order by which I sort it. Specifically: >>> Listing.objects.order_by("book__courses") gives me Listings with id's (5, 1, 3, 5, 2, 4), and >>> Listing.objects.order_