Hi!

I can't order the results of a queryset by a field in a related
table..

I have this set of applications (they are far more complex, i'm
cutting out all the unnecessary parts):

images app:
class Subject(models.Model):
photographer = models.ForeignKey(Author)
[... a lot more stuff..]

class Shoot(models.Model):
subject = models.ForeignKey(Subject)
[... again a lot more stuff..]

class Version(models.Model):
shoot = models.ForeignKey(Shoot)
[...yet even more stuff.. ]


lists app:
class Author(models.Model):
name = models.CharField(max_length=50)
surname = models.CharField(max_length=50)

So basically the relation goes like: version <- shoot <- subject ->
author

Ok.. i need to order the results of a Version.objects.all() query by
author surname... with no success.. can someone help me to write the
correct syntax to do this?

Bear in mind that the table structure is fixed, i can't change it
because i'm working for a client who asked specifically this
structure.

I did some research in this group but i couldn't find the answer.. can
anyone please help me writing the correct syntax for the queryset?

Thank you in advance!

-Vokial-

PS. sorry for any grammar errors, i'm not english (as you might have
guessed :P )

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

Reply via email to