On rajoute le nombre de questions pour le vote
This commit is contained in:
parent
a5fdc84161
commit
39adc92c68
2 changed files with 9 additions and 1 deletions
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<h1 class="title">{% trans "Vote pour la question :" %} {{ question.text }}</h1>
|
<h1 class="title">{{ question.election.name }}</h1>
|
||||||
|
<h3 class="subtitle">{% trans "Vote pour la question :" %} {{ question.text }} ({{ q_index }}/{{ q_total }})</h3>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="columns is-centered">
|
<div class="columns is-centered">
|
||||||
|
|
|
@ -389,6 +389,13 @@ class VoteView(OpenElectionOnlyMixin, DetailView):
|
||||||
|
|
||||||
return reverse("election.vote", args=[q_next])
|
return reverse("election.vote", args=[q_next])
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
questions = list(self.object.election.questions.all())
|
||||||
|
context["q_index"] = questions.index(self.object) + 1
|
||||||
|
context["q_total"] = len(questions)
|
||||||
|
return context
|
||||||
|
|
||||||
def get_object(self):
|
def get_object(self):
|
||||||
question = super().get_object()
|
question = super().get_object()
|
||||||
# Seulement les utilisateur·ice·s ayant le droit de voter dans l'élection
|
# Seulement les utilisateur·ice·s ayant le droit de voter dans l'élection
|
||||||
|
|
Loading…
Reference in a new issue