Exemplo n.º 1
0
def protest_edit(request, pk):
    protest = Protest.objects.get(pk= pk)

    if request.method == 'POST':
        form = ProtestForm (request.POST, instance = post)
        if form.is_valid():
            protest = form.save()
            return redirect('blog.views.protest_edit', protest.pk)

    else: form = ProtestForm (instance = protest)
    return render(request, 'templates/protest_form.html', {
        'form' : form,
        })
Exemplo n.º 2
0
def protest_new(request):

    if request.method == 'POST':
        form = ProtestForm(request.POST)
        if form.is_valid():
            protest = form.save()
            return redirect('protest.views.protest_detail', protest.pk)

    else:
        form = ProtestForm

    return render(request, 'protest/protest_form.html', {
        'form': form,
    })
Exemplo n.º 3
0
def protest_new(request):

    if request.method == 'POST' :
        form = ProtestForm (request.POST)
        if form.is_valid():
            protest = form.save ()
            return redirect('protest.views.protest_detail', protest.pk)

    else :
        form = ProtestForm

    return render(request, 'protest/protest_form.html', {
        'form' : form,
        })
Exemplo n.º 4
0
def protest_edit(request, pk):
    protest = Protest.objects.get(pk=pk)

    if request.method == 'POST':
        form = ProtestForm(request.POST, instance=post)
        if form.is_valid():
            protest = form.save()
            return redirect('blog.views.protest_edit', protest.pk)

    else:
        form = ProtestForm(instance=protest)
    return render(request, 'templates/protest_form.html', {
        'form': form,
    })