def remove_team_member(request, team, member_id): try: member = team.member_set.get(pk=member_id) except TeamMember.DoesNotExist: return HttpResponseRedirect( reverse('sentry-manage-team', args=[team.slug])) if member.user == team.owner: return HttpResponseRedirect( reverse('sentry-manage-team', args=[team.slug])) if not can_remove_team_member(request.user, member): return HttpResponseRedirect(reverse('sentry')) if request.POST: member.delete() return HttpResponseRedirect( reverse('sentry-manage-team', args=[team.slug])) context = csrf(request) context.update({ 'page': 'members', 'member': member, 'SUBSECTION': 'members', }) return render_with_team_context(team, 'sentry/teams/members/remove.html', context, request)
def remove_team_member(request, team, member_id): try: member = team.member_set.get(pk=member_id) except TeamMember.DoesNotExist: return HttpResponseRedirect(reverse('sentry-manage-team', args=[team.slug])) if member.user == team.owner: return HttpResponseRedirect(reverse('sentry-manage-team', args=[team.slug])) if not can_remove_team_member(request.user, member): return HttpResponseRedirect(reverse('sentry')) if request.POST: member.delete() return HttpResponseRedirect(reverse('sentry-manage-team', args=[team.slug])) context = csrf(request) context.update({ 'page': 'members', 'member': member, 'SUBSECTION': 'members', }) return render_with_team_context(team, 'sentry/teams/members/remove.html', context, request)
def remove_team_member(request, team, member_id): try: member = team.member_set.get(pk=member_id) except TeamMember.DoesNotExist: return HttpResponseRedirect(reverse("sentry-manage-team", args=[team.slug])) if member.user == team.owner: return HttpResponseRedirect(reverse("sentry-manage-team", args=[team.slug])) if not can_remove_team_member(request.user, member): return HttpResponseRedirect(reverse("sentry")) if request.POST: member.delete() return HttpResponseRedirect(reverse("sentry-manage-team", args=[team.slug])) context = csrf(request) context.update({"page": "members", "member": member, "team": team}) return render_to_response("sentry/teams/members/remove.html", context, request)