OK, I understand the problem to be this: you have a user table and a
team table, and the user table has a foreignkey field that relates
back to team.  Assuming a user table named USERS and a team table
named TEAM, in your view, you would do a lookup like this:

team_members =
TEAM.objects.get(team_name="foo").USER_set.exclude(user_name="someperson")
# that exclude keeps the current user off of the list

Add team_members to the template's context.  Then you could do
something like this in your template:

<select name="team_members" id="team_members">
{% for member in team_members %}
<option value="{{ member.id }}">{{ member.user_name }}</option>
{% endfor %}
</select>

On Apr 30, 8:51 am, "5264277-ew5264277"
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> In a regule view/template.
>
> Thanks,
> Andrew
>
> ============= From Web Mail ================
> ============================================
> Andrew Holt, Managing Director,
> 4A Solutions
>
> Office : +44(0)1257 268351
> Mobile: +44(0)7841 340 608
> email: [EMAIL PROTECTED]
>
> veritas vos liberabit -- The truth will set you free
> ============================================
>
> ---------- Original Message -----------
> From: Jeff <[EMAIL PROTECTED]>
> To: Django users <django-users@googlegroups.com>
> Sent: Mon, 30 Apr 2007 12:45:42 -0000
> Subject: Re: context sensitive menus
>
> > Are you doing this in Django admin or in a regular view/template?
>
> > Jeff
>
> > On Apr 30, 8:41 am, "5264277-ew5264277"
> > <[EMAIL PROTECTED]> wrote:
> > > Hi,
>
> > > I am fairly new to Django, so this may be an easy question.
>
> > > I have an app where I have a team member table.  One of the attributes is 
> > > the
> > > team that they are a member of.
>
> > > What I want to do is have a drop down menu that lists the team, and 
> > > another
> > > which only lists the members of that team.
>
> > > Any ideas ?
>
> > > Regards,
> > > Andrew
>
> > > ============= From Web Mail ================
> > > ============================================
> > > Andrew Holt, Managing Director,
> > > 4A Solutions
>
> > > email: [EMAIL PROTECTED]
>
> > > veritas vos liberabit -- The truth will set you free
> > > ============================================
>
> > ------- End of Original Message -------


--~--~---------~--~----~------------~-------~--~----~
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