Re: Searches Across Many-to-Many with Intermediate Table

2007-11-01 Thread Andy Brody
Awesome! I thought there would to be a way to use .values().distinct() without tons of subsequent queries. I actually just posted the core of my model -- there are several more related classes, but this covers the basic idea. As a result, I might be back looking for clarification on that keyword

Re: Searches Across Many-to-Many with Intermediate Table

2007-11-01 Thread Malcolm Tredinnick
On Thu, 2007-11-01 at 11:35 -0700, Andy Brody wrote: > Ah, thanks for the values() hint. It seems to work decently. I don't > really need to access related model fields, I just want a list of > unique group objects associated with a given musician's activities. > > The above becomes instead: > >

Re: Searches Across Many-to-Many with Intermediate Table

2007-11-01 Thread Scott SA
Hi Andy, On 10/31/07, Andy Brody ([EMAIL PROTECTED]) wrote: >I'm using an intermediate table of Activities to relate Musicians, >Instruments, and Groups. Is there a good way to select groups from the >musician's activities? I've been doing stuff like [act.group for act >in theMusician.activity_s

Re: Searches Across Many-to-Many with Intermediate Table

2007-11-01 Thread Andy Brody
Ah, thanks for the values() hint. It seems to work decently. I don't really need to access related model fields, I just want a list of unique group objects associated with a given musician's activities. The above becomes instead: qset = theMusician.activity_set.all().values('group').distinct() #

Re: Searches Across Many-to-Many with Intermediate Table

2007-10-31 Thread Malcolm Tredinnick
On Wed, 2007-10-31 at 16:46 -0700, Andy Brody wrote: > Hi all, > > I'm using an intermediate table of Activities to relate Musicians, > Instruments, and Groups. Is there a good way to select groups from the > musician's activities? I've been doing stuff like [act.group for act > in theMusician.ac

Searches Across Many-to-Many with Intermediate Table

2007-10-31 Thread Andy Brody
Hi all, I'm using an intermediate table of Activities to relate Musicians, Instruments, and Groups. Is there a good way to select groups from the musician's activities? I've been doing stuff like [act.group for act in theMusician.activity_set.all()]. This works pretty well, except that there are