예제 #1
0
파일: views.py 프로젝트: NEOatNHNG/pootle
def admin_page(request, page_id):
    """Administration view."""

    lp = get_object_or_404(LegalPage, id=page_id)

    if request.method == 'POST':
        form = LegalPageForm(request.POST, instance=lp)

        if form.is_valid():
            form.save()
            return redirect('legalpages.views.admin')

    else:
        form = LegalPageForm(instance=lp)

    return render_to_response('legalpages/admin/edit.html', {'form': form},
            RequestContext(request))
예제 #2
0
파일: views.py 프로젝트: notz/pootle
def admin(request):
    """Lists available pages in the administration."""
    msg = ''

    if request.method == 'POST':
        form = LegalPageForm(request.POST)

        if form.is_valid():
            form.save()
            form = LegalPageForm()
            msg = _("Legal Page created.")
    else:
        form = LegalPageForm()

    lps = LegalPage.objects.all()

    return render_to_response('legalpages/admin/list.html', {
        'legalpages': lps,
        'form': form,
        'message': msg,
        'show_delete': False
    }, RequestContext(request))
예제 #3
0
파일: views.py 프로젝트: notz/pootle
def admin_page(request, page_id):
    """Administration view."""
    lp = get_object_or_404(LegalPage, id=page_id)

    if request.method == 'POST':

        if '_delete' in request.POST:
            lp.delete()
            return redirect('legalpages.views.admin')

        form = LegalPageForm(request.POST, instance=lp)

        if form.is_valid():
            form.save()
            return redirect('legalpages.views.admin')

    else:
        form = LegalPageForm(instance=lp)

    return render_to_response('legalpages/admin/edit.html', {
        'form': form,
        'show_delete': True
    }, RequestContext(request))
예제 #4
0
파일: views.py 프로젝트: NEOatNHNG/pootle
def admin(request):
    """Lists available pages in the administration."""

    msg = ''

    if request.method == 'POST':
        form = LegalPageForm(request.POST)

        if form.is_valid():
            form.save()
            form = LegalPageForm()
            msg = _("Legal Page created.")
    else:
        form = LegalPageForm()

    lps = LegalPage.objects.all()

    return render_to_response('legalpages/admin/list.html',
            {'legalpages': lps, 'form': form, 'message': msg},
            RequestContext(request))