On Feb 4, 2007, at 8:44 AM, Ramiro Morales wrote: > > On 2/4/07, Tom Smith <[EMAIL PROTECTED]> wrote: >> >> I have a model that looks roughly like this... >> >> class Client(models.Model): >> name = models.CharField(maxlength=200, default='') >> >> class Competitor(models.Model): >> client = models.ForeignKey(Client) >> site = models.ForeignKey(Site) >> >> class Site(models.Model): >> client = models.ForeignKey(Client) >> pagerank = models.IntegerField(default=0) >> >> [...] >> >> ... I get this... >> >>> File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ >>> python2.4/site-packages/MySQLdb/connections.py", line 35, in >>> defaulterrorhandler >>> raise errorclass, errorvalue >>> OperationalError: (1054, "Unknown column 'site.pagerank' in 'order >>> clause'") >> > > See tickets #2210 and 2076 where a patch is proposed to solve the > problem.
I've also found that having a default ordering on your model can work without having to specify it. So in your site model you'd have class Meta: ordering = ('pagerank',) Then in your query, if you order by your site foreign key, you get that fk's default ordering, no need to specify the pagerank in the query. Don --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---