Hi, according to the docs, I should be able order by a field in another
table like below, but for some reason I can't get it to work. I'm new
to django. Thought I'd give it a shot as I've primarily been using
Ruby on Rails.
views.py:
products = Product.objects.order_by('products_brand.name',
'products_product.name')
models.py:
class Brand(models.Model):
name = models.CharField(maxlength=192)
link = models.CharField(maxlength=192)
class Product(models.Model):
category = models.ForeignKey(Category)
brand = models.ForeignKey(Brand)
name = models.CharField(maxlength=192)
description = models.TextField()
link = models.CharField(maxlength=384)
Any ideas as to what I'm doing wrong, or do the docs need fixing?
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
-~----------~----~----~----~------~----~------~--~---