def add_acl(request): "add an acl" if request.method == 'POST': form = ACLForm(request.POST) if form.is_valid(): try: form.save() msg = _('The ACL rule was created successfully') messages.info(request, msg) return HttpResponseRedirect(reverse('acl-rules')) except DatabaseError, e: print e msg = _('The ACL rule could not be created') messages.info(request, msg) return HttpResponseRedirect(reverse('acl-rules'))
def add_acl(request): "add an acl" if request.method == "POST": form = ACLForm(request.POST) if form.is_valid(): try: form.save() msg = _("The ACL rule was created successfully") messages.info(request, msg) return HttpResponseRedirect(reverse("acl-rules")) except DatabaseError, e: print e msg = _("The ACL rule could not be created") messages.info(request, msg) return HttpResponseRedirect(reverse("acl-rules"))
def edit_acl(request, aclid): "Edit an acl" acl = get_object_or_404(AclRule, pk=aclid) if request.method == "POST": form = ACLForm(request.POST, instance=acl) if form.is_valid(): try: form.save() msg = _("The ACL Rule has been updated") except DatabaseError: msg = _("The ACL Rule could not be updated") messages.info(request, msg) return HttpResponseRedirect(reverse("acl-rules")) else: form = ACLForm(instance=acl) return render_to_response("web/config/edit_acl.html", locals(), context_instance=RequestContext(request))
def edit_acl(request, aclid): "Edit an acl" acl = get_object_or_404(AclRule, pk=aclid) if request.method == 'POST': form = ACLForm(request.POST, instance=acl) if form.is_valid(): try: form.save() msg = _('The ACL Rule has been updated') except DatabaseError: msg = _('The ACL Rule could not be updated') messages.info(request, msg) return HttpResponseRedirect(reverse('acl-rules')) else: form = ACLForm(instance=acl) return render_to_response('web/config/edit_acl.html', locals(), context_instance=RequestContext(request))