def page_add(request, response_format="html"): "Static Page add" if request.POST: form = PageForm(request.POST) if form.is_valid(): page = form.save() return HttpResponseRedirect(reverse("core_admin_page_view", args=[page.id])) else: form = PageForm() return render_to_response( "core/administration/page_add", {"form": form}, context_instance=RequestContext(request), response_format=response_format, )
def page_edit(request, page_id, response_format="html"): "Static Page edit" page = get_object_or_404(Page, pk=page_id) if request.POST: form = PageForm(request.POST, instance=page) if form.is_valid(): page = form.save() return HttpResponseRedirect(reverse("core_admin_page_view", args=[page.id])) else: form = PageForm(instance=page) return render_to_response( "core/administration/page_edit", {"page": page, "form": form}, context_instance=RequestContext(request), response_format=response_format, )