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
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:
>
>
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
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()
#
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
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
6 matches
Mail list logo