Restreint des views à la méthode POST

This commit is contained in:
Tom Hubrecht 2021-03-25 09:41:29 +01:00
parent f275b1bbed
commit 52839ff987

View file

@ -1,12 +1,12 @@
from django.contrib import messages
from django.contrib.messages.views import SuccessMessageMixin
# from django.db.models import Count, Prefetch
from django.http import Http404, HttpResponseRedirect
from django.urls import reverse
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
from django.views.decorators.http import require_POST
from django.views.generic import (
CreateView,
DetailView,
@ -241,6 +241,7 @@ class ElectionArchiveView(CreatorOnlyEditMixin, BackgroundUpdateView):
# #############################################################################
@method_decorator(require_POST, name="dispatch")
class AddQuestionView(CreatorOnlyEditMixin, CreateView):
model = Election
form_class = QuestionForm
@ -287,6 +288,7 @@ class DelQuestionView(CreatorOnlyEditMixin, BackgroundUpdateView):
# #############################################################################
@method_decorator(require_POST, name="dispatch")
class AddOptionView(CreatorOnlyEditMixin, CreateView):
model = Question
form_class = OptionForm