On Thu, Nov 26, 2009 at 6:31 PM, David <davidkazuh...@gmail.com> 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 <davidkazuh...@gmail.com> wrote:
> 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 the duplicate id "swallowing up" the missing records. I
> have no clue why though... hope these details help clarify my problem.
>

I'd suggest to perform the same queries using SQL to see if the
results you get are different from what you get when using the ORM. I say
this because the last paragraph in the order_by() method description:

http://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by-fields

Regards,

-- 
Ramiro Morales  |  http://rmorales.net

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to