コード例 #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,
    )