Beispiel #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,
        })
Beispiel #2
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,
    })
Beispiel #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,
    })
Beispiel #4
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,
        })