Hello django users,

Bit of a newbie question.

For model like this:

class X(models.Model):
        name = models.CharField(maxlength=20)

class Y(models.Model):
        name = models.CharField(maxlength=20)
        x = models.ForeignKey(X)

class Z(models.Model):
        name = models.CharField(maxlength=20)
        y = models.ForeignKey(Y)

I do not know how to order by x.name in the view:

order_key = name    #order by z.name, fine
order_key = y_table.name #order by y.name, fine
#order_key = ???? #order by x.name, i don't know how

the_list = Z.objects.order_by(order_key)

What would be the elegant soluton?

Thanks,
Mario Gudelj


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