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 <[EMAIL PROTECTED]> wrote:
> 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.get(team=team_name)
> > ups = UserProfile.objects.filter(team=team)
> > users = [up.user for up in ups]
>
> > You now have a list of users on the team. There may be another way to
> > do this, but none leaps to mind.
>
> Thanks Peter. Works a treat.
>
> --
> You back your data up on the same planet?http://www.monkeez.org
> PGP key: 0x7111B833
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to