Rajout d'un texte expliquant le mode de scrutin pour chaque question

This commit is contained in:
Tom Hubrecht 2021-03-19 12:04:21 +01:00
parent 84199c38fe
commit c59ac43478
3 changed files with 16 additions and 1 deletions

View file

@ -21,3 +21,11 @@ CONNECTION_METHODS = {
QUESTION_TYPES = [ QUESTION_TYPES = [
("assentiment", _("Assentiment")), ("assentiment", _("Assentiment")),
] ]
VOTE_RULES = {
"assentiment": _(
"Le mode de scrutin pour cette question est un vote par assentiment. "
"Vous pouvez donc sélectionner autant d'options que vous souhaitez. "
"Vous pouvez également ne sélectionner aucune option."
)
}

View file

@ -8,6 +8,12 @@
<h3 class="subtitle">{% trans "Vote pour la question :" %} {{ question.text }} ({{ q_index }}/{{ q_total }})</h3> <h3 class="subtitle">{% trans "Vote pour la question :" %} {{ question.text }} ({{ q_index }}/{{ q_total }})</h3>
<hr> <hr>
<div class="message is-warning">
<p class="message-body">
{{ vote_rule|safe }}
</p>
</div>
<div class="columns is-centered"> <div class="columns is-centered">
<div class="column is-two-thirds"> <div class="column is-two-thirds">
<form action="" method="post"> <form action="" method="post">

View file

@ -26,7 +26,7 @@ from .forms import (
) )
from .mixins import CreatorOnlyEditMixin, CreatorOnlyMixin, OpenElectionOnlyMixin from .mixins import CreatorOnlyEditMixin, CreatorOnlyMixin, OpenElectionOnlyMixin
from .models import Election, Option, Question from .models import Election, Option, Question
from .staticdefs import MAIL_VOTERS, QUESTION_TYPES from .staticdefs import MAIL_VOTERS, QUESTION_TYPES, VOTE_RULES
from .utils import create_users, send_mail from .utils import create_users, send_mail
# TODO: access control *everywhere* # TODO: access control *everywhere*
@ -396,6 +396,7 @@ class VoteView(OpenElectionOnlyMixin, DetailView):
questions = list(self.object.election.questions.all()) questions = list(self.object.election.questions.all())
context["q_index"] = questions.index(self.object) + 1 context["q_index"] = questions.index(self.object) + 1
context["q_total"] = len(questions) context["q_total"] = len(questions)
context["vote_rule"] = VOTE_RULES[self.object.type]
return context return context
def get_object(self): def get_object(self):