コード例 #1
0
ファイル: role.py プロジェクト: gefeng24/adminset
def role_add(request):
    temp_name = "accounts/accounts-header.html"
    if request.method == "POST":
        form = RoleListForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('role_list'))
    else:
        form = RoleListForm()

    kwvars = {
        'temp_name': temp_name,
        'form': form,
        'request': request,
    }

    return render(request, 'accounts/role_add.html', kwvars)
コード例 #2
0
ファイル: role.py プロジェクト: gefeng24/adminset
def role_edit(request, ids):
    iRole = RoleList.objects.get(id=ids)
    temp_name = "accounts/accounts-header.html"
    if request.method == "POST":
        form = RoleListForm(request.POST,instance=iRole)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('role_list'))
    else:
        form = RoleListForm(instance=iRole)

    kwvars = {
        'temp_name': temp_name,
        'ids': ids,
        'form': form,
        'request': request,
    }

    return render(request, 'accounts/role_edit.html', kwvars)
コード例 #3
0
def role_add(request):
    temp_name = "accounts/accounts-header.html"
    if request.method == "POST":
        form = RoleListForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('role_list'))
    else:
        form = RoleListForm()

    kwvars = {
        'temp_name': temp_name,
        'form': form,
        'request': request,
    }

    return render(request, 'accounts/role_add.html', kwvars)
コード例 #4
0
ファイル: views.py プロジェクト: znavy/AXES
def editRoleView(request, ID):
    role_info = Role.objects.get(id=ID)
    if request.method == 'POST':
        form = RoleListForm(request.POST, instance=role_info)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('rolelisturl'))
    else:
        role_form = RoleListForm(instance=role_info)
    context_dict = {
        'form': role_form,
        'ID': ID,
    }
    return render(request, 'common/editrole.html', context_dict)
コード例 #5
0
def role_edit(request, ids):
    iRole = RoleList.objects.get(id=ids)
    temp_name = "accounts/accounts-header.html"
    if request.method == "POST":
        form = RoleListForm(request.POST, instance=iRole)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('role_list'))
    else:
        form = RoleListForm(instance=iRole)

    kwvars = {
        'temp_name': temp_name,
        'ids': ids,
        'form': form,
        'request': request,
    }

    return render(request, 'accounts/role_edit.html', kwvars)
コード例 #6
0
def role_edit(request, ids):
    iRole = RoleList.objects.get(id=ids)
    #     print "the iRole is:%s" % iRole
    temp_name = "skaccounts/accounts-header.html"
    if request.method == "POST":
        form = RoleListForm(request.POST, instance=iRole)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('role_list'))
    else:
        form = RoleListForm(instance=iRole)


#         print "the form is:%s" % form
    kwvars = {
        'temp_name': temp_name,
        'ids': ids,
        'form': form,
        'request': request,
    }

    return render_to_response('skaccounts/role_edit.html', kwvars,
                              RequestContext(request))