示例#1
0
文件: views.py 项目: alejo8591/maker
def pagefolder_add(request, response_format="html"):
    "Folder for Static Pages add"

    if request.POST:
        form = PageFolderForm(request.POST)
        if form.is_valid():
            folder = form.save()
            return HttpResponseRedirect(reverse("core_admin_pagefolder_view", args=[folder.id]))
    else:
        form = PageFolderForm()

    return render_to_response(
        "core/administration/pagefolder_add",
        {"form": form},
        context_instance=RequestContext(request),
        response_format=response_format,
    )
示例#2
0
文件: views.py 项目: alejo8591/maker
def pagefolder_edit(request, folder_id, response_format="html"):
    "Folder for Static Pages edit"

    folder = get_object_or_404(PageFolder, pk=folder_id)
    if request.POST:
        form = PageFolderForm(request.POST, instance=folder)
        if form.is_valid():
            folder = form.save()
            return HttpResponseRedirect(reverse("core_admin_pagefolder_view", args=[folder.id]))
    else:
        form = PageFolderForm(instance=folder)

    return render_to_response(
        "core/administration/pagefolder_edit",
        {"folder": folder, "form": form},
        context_instance=RequestContext(request),
        response_format=response_format,
    )