On montre qu'on a enregistré le vote pour une élection
This commit is contained in:
parent
561f180eb3
commit
097157d480
2 changed files with 16 additions and 0 deletions
|
@ -23,6 +23,19 @@
|
|||
|
||||
{% if election.start_date < current_time %}
|
||||
<div class="level-right">
|
||||
{# Confirmation de vote #}
|
||||
{% if has_voted %}
|
||||
<div class="level-item">
|
||||
<div class="tag is-medium is-outlined is-success is-light">
|
||||
<span class="icon">
|
||||
<i class="fas fa-check"></i>
|
||||
</span>
|
||||
<span>{% trans "Votre vote a bien été enregistré." %}</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{# Statut de l'élection #}
|
||||
<div class="level-item">
|
||||
<span class="tag is-medium is-outlined is-light is-primary">
|
||||
{% if election.end_date < current_time %}
|
||||
|
|
|
@ -347,6 +347,9 @@ class ElectionView(DetailView):
|
|||
if user.is_authenticated:
|
||||
context["can_vote"] = user.can_vote(self.request, context["election"])
|
||||
context["cast_questions"] = user.cast_questions.all()
|
||||
context["has_voted"] = user.cast_elections.filter(
|
||||
pk=context["election"].pk
|
||||
).exists()
|
||||
|
||||
return context
|
||||
|
||||
|
|
Loading…
Reference in a new issue