コード例 #1
0
ファイル: permission.py プロジェクト: eagle2015/OpsAdmin
def AddPermission(request):
    if request.method == "POST":
        form = PermissionListForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('listpermissionurl'))
    else:
        form = PermissionListForm()
    kwvars = {
        'form':form,
        'request':request,
    }
    return render_to_response('UserManage/permission.add.html',kwvars,RequestContext(request))
コード例 #2
0
ファイル: permission.py プロジェクト: 277800076/sadmin
def EditPermission(request,ID):
    iPermission = PermissionList.objects.get(id=ID)

    if request.method == "POST":
        form = PermissionListForm(request.POST,instance=iPermission)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('listpermissionurl'))
    else:
        form = PermissionListForm(instance=iPermission)

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

    return render_to_response('UserManage/permission.edit.html',kwvars,RequestContext(request))
コード例 #3
0
def addpermission(request):
    if request.method == "POST":
        form = PermissionListForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('listpermissionurl'))
    else:
        form = PermissionListForm()
    kwvars = {
        'form': form,
        'request': request,
    }
    return render_to_response('UserManage/permission.add.html', kwvars,
                              RequestContext(request))
コード例 #4
0
ファイル: permission.py プロジェクト: luoguoling/spider
def AddPermission(request):
    if request.method == "POST":
        form = PermissionListForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/accounts/permission/list')
    else:
        form = PermissionListForm()

    kwvars = {
        'form':form,
        'request':request,
        'title':'Permission Add',
        'postUrl':'/accounts/permission/add/',
    }

    return render_to_response('common/formadd.html',kwvars,RequestContext(request))
コード例 #5
0
def editpermission(request, num):
    ipermission = PermissionList.objects.get(id=num)

    if request.method == "POST":
        form = PermissionListForm(request.POST, instance=ipermission)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('listpermissionurl'))
    else:
        form = PermissionListForm(instance=ipermission)

    kwvars = {
        'num': num,
        'form': form,
        'request': request,
    }
    return render_to_response('UserManage/permission.edit.html', kwvars,
                              RequestContext(request))
コード例 #6
0
def EditPermission(request, ID):
    iPermission = PermissionList.objects.get(id=ID)

    if request.method == "POST":
        form = PermissionListForm(request.POST, instance=iPermission)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('listpermissionurl'))
    else:
        form = PermissionListForm(instance=iPermission)

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

    return render(request, 'UserManage/permission.edit.html', kwvars)
コード例 #7
0
ファイル: permission.py プロジェクト: luoguoling/spider
def EditPermission(request,ID):
    iPermission = PermissionList.objects.get(id=ID)

    if request.method == "POST":
        form = PermissionListForm(request.POST,instance=iPermission)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('/accounts/permission/list')
    else:
        form = PermissionListForm(instance=iPermission)

    kwvars = {
        'form':form,
        'request':request,
        'title':'Permission Edit',
        'postUrl':'/accounts/permission/edit/%s/' %ID,
    }

    return render_to_response('common/formedit.html',kwvars,RequestContext(request))