def team_list(request): """ Return teams list. Displays team members from the user's own organization. Displays team members from any network that the user's organization is part of. """ # the user's organization organization = request.user.organization networks = Organization.get_org_networks(organization) partners = Organization.get_org_collaborators(organization) # form for adding a new user to the team adduserform = AddUserForm() # only visible for admin users return render(request, 'editorial/team.html', { 'organization': organization, 'networks': networks, 'partners': partners, 'adduserform': adduserform, })
def __init__(self, *args, **kwargs): self.request = kwargs.pop("request") super(StoryForm, self).__init__(*args, **kwargs) self.fields['collaborate_with'].queryset = Organization.get_org_collaborators(self.request.user.organization) self.fields['team'].queryset = Organization.get_org_users(self.request.user.organization)