Esempio n. 1
0
File: views.py Progetto: 5n1p/treeio
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)
Esempio n. 2
0
File: views.py Progetto: 5n1p/treeio
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)
Esempio n. 3
0
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)
Esempio n. 4
0
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)