def edit(request, offset): offset = get_object_or_404(Page, pk=offset) if request.method == 'POST': form = WebsiteForm(request.POST, instance=offset) if form.is_valid(): form.save() return HttpResponseRedirect('/site/admin') else: form = WebsiteForm(instance=offset) return render_to_response("cms/cms.html", {'form': form}, context_instance=RequestContext(request))
def cms(request): if request.method == 'POST': form = WebsiteForm(request.POST) if form.is_valid(): newpage = form.save(commit=False) newpage.order = order_for_last_page() newpage.save() return HttpResponseRedirect('/site/admin') else: form = WebsiteForm() return render_to_response("cms/cms.html", {"form": form}, context_instance=RequestContext(request))
def cms(request): if request.method == 'POST': form = WebsiteForm(request.POST) if form.is_valid(): newpage = form.save(commit=False) newpage.order = order_for_last_page() newpage.save() return HttpResponseRedirect('/site/admin') else: form = WebsiteForm() return render_to_response("cms/cms.html", { "form": form }, context_instance=RequestContext(request))