Given:
class Topic(models.Model):
title = models.CharField(maxlength=200)
link = models.CharField(maxlength=200)
class Item(models.Model):
topic = models.ForeignKey(Topic)
user = models.ForeignKey(User)
I want to get a list of Items ordered by the title of their Topic:
item_list = Item.objects.order_by('topics_topic.title')
That's straight out of the documentation
http://www.djangoproject.com/documentation/db-api/#limiting-querysets
but I get an exception: "Unknown table 'topics_topic' in order clause"
What am I doing wrong?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---