示例#1
0
def AddPermission(request):
    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
def AddPermission(request):
    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))
示例#3
0
def EditPermission(request, ID):
    iPermission = PermissonList.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))
示例#4
0
def EditPermission(request, ID):
    iPermission = PermissonList.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))