Re: Querying a User profile

2008-06-30 Thread [EMAIL PROTECTED]
If you're using the svn release, you can filter directly on the user using the backwards relationship filtering thing. users=User.objects.filter(userprofile_set__team=team) Where userprofile_set is the related_name given in the userprofile's 'user' FK declaration. On Jun 30, 12:51 am, AdamC <[E

Re: Querying a User profile

2008-06-29 Thread AdamC
On Mon, Jun 30, 2008 at 12:08 AM, Peter Rowell <[EMAIL PROTECTED]> wrote: > >> Any advice on how to query User for a particular team name? > > Since the relationship is between Team and UserProfile, I believe > that's where you need to start. Something like this would work: > > team = Team.objects

Re: Querying a User profile

2008-06-29 Thread Peter Rowell
> Any advice on how to query User for a particular team name? Since the relationship is between Team and UserProfile, I believe that's where you need to start. Something like this would work: team = Team.objects.get(team=team_name) ups = UserProfile.objects.filter(team=team) users = [up.user for

Querying a User profile

2008-06-29 Thread AdamC
I have two models, UserProfile and Team[2]. I want to create a Team page which lists all the users who belong to that team. I'm not sure how to specify this in my view. [1] The problem I run into is that team doesn't exist within User. Any advice on how to query User for a particular team name?