def AddRole(request): if request.method == "POST": form = RoleListForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('UserManage:listroleurl')) else: form = RoleListForm() kwvars = { 'form':form, 'request':request, } return render_to_response('UserManage/role.add.html',kwvars,RequestContext(request))
def EditRole(request,ID): iRole = RoleList.objects.get(id=ID) if request.method == "POST": form = RoleListForm(request.POST,instance=iRole) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('UserManage:listroleurl')) else: form = RoleListForm(instance=iRole) kwvars = { 'ID':ID, 'form':form, 'request':request, } return render_to_response('UserManage/role.edit.html',kwvars,RequestContext(request))