On Fri, May 30, 2008 at 6:09 PM, robstar <[EMAIL PROTECTED]> wrote: > > Thanks for your help Richard.. taking out the select_related() > results in the same problem. Isn't a OnetoOneField just a fancy name > wrapper for a foreign key?? > > mysql> describe itemengine_gear; > +-----------------+--------------+------+-----+---------+-------+ > | Field | Type | Null | Key | Default | Extra | > +-----------------+--------------+------+-----+---------+-------+ > | generic_info_id | int(11) | | PRI | 0 | | > +-----------------+--------------+------+-----+---------+-------+ > > >>> gear = Gear.objects.order_by('-generic_info__hits') > >>> print gear > [snipped some] > OperationalError: (1054, "Unknown column > 'itemengine_gear.generic_info__hits' in 'order clause'") > > I can't believe I used this OnetoOne and populated a whole db around > this model and it's broken. Do you think this is a bug ? Is there > some way I can trick django and change the model to a regular foreign > key without having to start everything over? > > Thanks. >
It was a bug, ordering by foreign key fields was notoriously fragile before queryset-refactor was merged into trunk. I just tried your example on current trunk and it works fine. So I'd advise updating to a current SVN checkout of Django. Karen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---