Ejemplo n.º 1
0
Archivo: views.py Proyecto: 5n1p/treeio
def page_add(request, response_format='html'):
    "Static Page add"

    if request.POST:
        form = PageForm(request.POST)
        if form.is_valid():
            page = form.save()
            return HttpResponseRedirect(reverse('core_admin_page_view', args=[page.id]))
    else:
        form = PageForm()

    return render_to_response('core/administration/page_add',
                              {'form': form},
                              context_instance=RequestContext(request), response_format=response_format)
Ejemplo n.º 2
0
def page_add(request, response_format='html'):
    "Static Page add"

    if request.POST:
        form = PageForm(request.POST)
        if form.is_valid():
            page = form.save()
            return HttpResponseRedirect(
                reverse('core_admin_page_view', args=[page.id]))
    else:
        form = PageForm()

    return render_to_response('core/administration/page_add', {'form': form},
                              context_instance=RequestContext(request),
                              response_format=response_format)
Ejemplo n.º 3
0
Archivo: views.py Proyecto: 5n1p/treeio
def page_edit(request, page_id, response_format='html'):
    "Static Page edit"

    page = get_object_or_404(Page, pk=page_id)
    if request.POST:
        form = PageForm(request.POST, instance=page)
        if form.is_valid():
            page = form.save()
            return HttpResponseRedirect(reverse('core_admin_page_view', args=[page.id]))
    else:
        form = PageForm(instance=page)

    return render_to_response('core/administration/page_edit',
                              {'page': page, 'form': form},
                              context_instance=RequestContext(request), response_format=response_format)
Ejemplo n.º 4
0
def page_edit(request, page_id, response_format='html'):
    "Static Page edit"

    page = get_object_or_404(Page, pk=page_id)
    if request.POST:
        form = PageForm(request.POST, instance=page)
        if form.is_valid():
            page = form.save()
            return HttpResponseRedirect(
                reverse('core_admin_page_view', args=[page.id]))
    else:
        form = PageForm(instance=page)

    return render_to_response('core/administration/page_edit', {
        'page': page,
        'form': form
    },
                              context_instance=RequestContext(request),
                              response_format=response_format)