So, basically you want this:
C.objects.filter(Bref__Dref__id=D_id).values_list('Aref')
Matías
Excerpts from [email protected]'s message of Tue Jan 11 07:58:05 -0200 2011:
> Let's say I have a model like:
>
> class A:
>
> class B:
> Dref = ForeignKey('D')
>
> class C:
> Aref = ForeignKey('A')
> Bref = ForeignKey('B')
>
> class D:
>
>
> I also have a view taking a D_id parameter and in this view I would
> like to create and show the list of A objects that are related to D
> through the B and C class.
>
> Assuming this decription makes any sense ( I'm struggling myself to
> read it :) ), is there any way to accomplish what I need?
>
> Cheers
>
> G.
>
--
Matías Aguirre <[email protected]>
--
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.