On Sep 20, 4:24 am, adelaide_mike <[email protected]> wrote:
> I have a multi-table model, each table related to the next by a one to
> many foreign key.
>
> I wish to do:
>
> q = Child.objects.filter(date__gte=startdate).order_by
> ('parent.grandparent.greatgrandparent__name')
>
> This raises an exception no such column:
> parent.grandparent.greatgrandparent__name
>
> Is there a workable way to do this?
>
> Thanks in advance for any ideas.
>
> Mike
You have to use the double-underscore format throughout.
q = Child.objects.filter(date__gte=startdate).order_by
('parent__grandparent__greatgrandparent__name')
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---