Ejemplo n.º 1
0
Archivo: views.py Proyecto: 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)
Ejemplo n.º 2
0
Archivo: views.py Proyecto: 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)
Ejemplo 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)
Ejemplo 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)