Restreint des views à la méthode POST
This commit is contained in:
parent
f275b1bbed
commit
52839ff987
1 changed files with 4 additions and 2 deletions
|
@ -1,12 +1,12 @@
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.messages.views import SuccessMessageMixin
|
from django.contrib.messages.views import SuccessMessageMixin
|
||||||
|
|
||||||
# from django.db.models import Count, Prefetch
|
|
||||||
from django.http import Http404, HttpResponseRedirect
|
from django.http import Http404, HttpResponseRedirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from django.utils.decorators import method_decorator
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
from django.views.decorators.http import require_POST
|
||||||
from django.views.generic import (
|
from django.views.generic import (
|
||||||
CreateView,
|
CreateView,
|
||||||
DetailView,
|
DetailView,
|
||||||
|
@ -241,6 +241,7 @@ class ElectionArchiveView(CreatorOnlyEditMixin, BackgroundUpdateView):
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@method_decorator(require_POST, name="dispatch")
|
||||||
class AddQuestionView(CreatorOnlyEditMixin, CreateView):
|
class AddQuestionView(CreatorOnlyEditMixin, CreateView):
|
||||||
model = Election
|
model = Election
|
||||||
form_class = QuestionForm
|
form_class = QuestionForm
|
||||||
|
@ -287,6 +288,7 @@ class DelQuestionView(CreatorOnlyEditMixin, BackgroundUpdateView):
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@method_decorator(require_POST, name="dispatch")
|
||||||
class AddOptionView(CreatorOnlyEditMixin, CreateView):
|
class AddOptionView(CreatorOnlyEditMixin, CreateView):
|
||||||
model = Question
|
model = Question
|
||||||
form_class = OptionForm
|
form_class = OptionForm
|
||||||
|
|
Loading…
Reference in a new issue