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))
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))
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))
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))
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))
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)
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))