Re: Dealing with multiple M2Ms

2009-02-25 Thread Jeff Gentry
> and suppose "obj_a" is your given A instance. Then I suspect this is the > type of queryset you're after: > C.objects.filter(Q(to_a=obj_a) | Q(to_b__to_a=obj_a)) This did the trick Malcolm, thanks. I'm not sure what was hanging me up as I could swear I had tried this one already, but

Re: Dealing with multiple M2Ms

2009-02-24 Thread Malcolm Tredinnick
On Tue, 2009-02-24 at 07:13 -0800, jgen...@jimmy.harvard.edu wrote: > Hi there ... > > Suppose I have three Models: > > Model A > > Model B, has a M2M with Model A > > Model C, has M2Ms with both Model A and Model B > > What I'm trying to do is to construct a query which will answer the >

Dealing with multiple M2Ms

2009-02-24 Thread jgentry
Hi there ... Suppose I have three Models: Model A Model B, has a M2M with Model A Model C, has M2Ms with both Model A and Model B What I'm trying to do is to construct a query which will answer the following question: "For a given A, what Cs does it have a relationship with, either through