コード例 #1
0
def remove_user_from_project(request, projectID, username):
    project = project_api.get_project(projectID)
    if request.method == 'POST':
        form = SelectAccessLevelForm()
        project_api.remove_user_from_project(projectID, username)
    else:
        form = SelectAccessLevelForm()
    users = project.users.all()
    users = users.exclude(username=request.user.username)

    context = {
        'title': 'Remove User from Project',
        'form': form,
        'project': project,
        'users': users,
        'confirm_message': 'This is an unrevert procedure ! This user will lose the permission to access this project !',
    }

    return render(request, 'UserSummary.html', context)
def remove_user_from_project(request, projectID, username):
    p = project_api.get_project(projectID)
    if request.method == 'POST':
        form = SelectAccessLevelForm()
        project_api.remove_user_from_project(projectID, username)
    else:
        form = SelectAccessLevelForm()
    users = p.users.all()
    users = users.exclude(username=request.user.username)

    context = {
        'title': 'Remove User from Project',
        'form': form,
        'project': p,
        'users': users,
        'confirm_message': 'This is an unrevert procedure ! This user will lose the permission to access this project !',
    }

    return render(request, 'UserSummary.html', context)