Re: Follow relations on three tables

2011-01-12 Thread gia...@gmail.com
On Tue, Jan 11, 2011 at 2:30 PM, Matias Aguirre wrote: > So, basically you want this: > > C.objects.filter(Bref__Dref__id=D_id).values_list('Aref') > Thanks! it was exactly what I needed -- Gianluca Sforna http://morefedora.blogspot.com http://identi.ca/giallu -

Re: Follow relations on three tables

2011-01-11 Thread Matias Aguirre
So, basically you want this: C.objects.filter(Bref__Dref__id=D_id).values_list('Aref') Matías Excerpts from gia...@gmail.com'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 =

Follow relations on three tables

2011-01-11 Thread gia...@gmail.com
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