On utilise la permission

This commit is contained in:
Tom Hubrecht 2021-03-20 20:21:48 +01:00
parent 71e22a139f
commit 16223e49f2

View file

@ -25,7 +25,12 @@ from .forms import (
UploadVotersForm,
VoterMailForm,
)
from .mixins import CreatorOnlyEditMixin, CreatorOnlyMixin, OpenElectionOnlyMixin
from .mixins import (
AdminOnlyMixin,
CreatorOnlyEditMixin,
CreatorOnlyMixin,
OpenElectionOnlyMixin,
)
from .models import Election, Option, Question
from .staticdefs import MAIL_VOTERS, QUESTION_TYPES, VOTE_RULES
from .utils import create_users, send_mail
@ -55,7 +60,7 @@ class BackgroundUpdateView(RedirectView):
# #############################################################################
class ElectionCreateView(SuccessMessageMixin, CreateView):
class ElectionCreateView(AdminOnlyMixin, SuccessMessageMixin, CreateView):
model = Election
form_class = ElectionForm
success_message = _("Élection créée avec succès !")