@require_objs_permissions_for_view(
    perm_names=["can_add_members"],
    permittee_func=get_user_from_req,
    target_func=get_queryset(Project, "proj_id"),
)
def update_member(request, proj_id, user_id):
    """Update a member's roles"""
    
    project = get_object_or_404(Project, id=proj_id)
    member = get_object_or_404(User, id=user_id)
    
    if request.method == "POST":
        form = MemberForm(
            project=project, user=member,
            giver=request.user, data=request.POST)
        
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(
                reverse("project_detail", args=[proj_id]))

    else:
        form = MemberForm(
            project=project, user=member,
            giver=request.user)
    
    return simple.direct_to_template(
        request,
        template=TEMPLATE_PATH+"/update_member.html",
        extra_context={
            "form": form,
            "project": project,
            "member": member,
            "breadcrumbs": (
                ("Home", reverse("home")),
                ("Project %s" % project.name, reverse("project_detail", args=[project.id])),
                ("Update Member %s" % member.username, request.path),
            ),
        },
    )
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/clearinghouse/project/views.py/update_member/original