Hi all!

I'm seeing a really strange behavior.

I have a query

q = Company.objects.filter(asOf__isnull = False).filter(Q(exchange =
1) | Q(exchange = 2)).order_by("name")[1:50]

When I run it from the command prompt, it gives proper results.

But when I run it as the web application / view, the sort doesn't seem
to be working. That is, I get the records back in the order they were
added.

I did q._get_sql_clause() to see what the difference was ... and there
isn't any to speak of:

>From the view code:

([...fields...],
' FROM "igapp_company" WHERE
("igapp_company"."asOf" IS NOT NULL AND
("igapp_company"."exchange" = %s OR "igapp_company"."exchange" = %s))
ORDER BY "igapp_company"."name" ASC LIMIT 25 ', [1, 2])

>From the command prompt:

([...fields...],
' FROM "igapp_company" WHERE
("igapp_company"."asOf" IS NOT NULL AND
("igapp_company"."exchange" = %s OR "igapp_company"."exchange" = %s))
ORDER BY "igapp_company"."name" ASC LIMIT 49 OFFSET 1 ', [1, 2])

Has anyone else experienced such behavior?

I've reindexed the affected table with no difference.

Thoughts?

-Zeb

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

Reply via email to