I'm having a similar problem in 0.91. The documentation
(http://www.djangoproject.com/documentation/db_api/#ordering) says you
can do this in the order_by clause. Such as:

choices.get_list(order_by=('polls.pub_date', 'choice'))

But that doesn't actually work (OperationalError: (1054, "Unknown
column 'polls.pub_date' in 'order clause'"). The sql you get from that
is:

SELECT
`polls_choices`.`id`,`polls_choices`.`poll_id`,`polls_choices`.`choice`,`polls_choices`.`votes`
FROM `polls_choices` ORDER BY `polls`.`pub_date` ASC,
`polls_choices`.`choice` ASC

(I got that from a print statement right before the exception was
generated). This sql clearly can't work. I think it would have to be
something more like (untested guess):

SELECT
`polls_choices`.`id`,`polls_choices`.`poll_id`,`polls_choices`.`choice`,`polls_choices`.`votes`
FROM `polls_choices`, `polls_polls` WHERE `polls_choices`.`poll_id` =
`polls_polls`.`id` ORDER BY `polls_polls`.`pub_date` ASC,
`polls_choices`.`choice` ASC


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to