Rajoute la liste des votant·e·s

This commit is contained in:
Tom Hubrecht 2020-12-23 17:09:04 +01:00
parent 8e60374091
commit 40762af938
2 changed files with 35 additions and 1 deletions

View file

@ -38,6 +38,7 @@
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
<form action="" method="post" enctype="multipart/form-data" id="import-voters"> <form action="" method="post" enctype="multipart/form-data" id="import-voters">
{% csrf_token %} {% csrf_token %}
@ -52,6 +53,7 @@
<span>{% trans "Enregistrer" %}</span> <span>{% trans "Enregistrer" %}</span>
</button> </button>
</div> </div>
<div class="control"> <div class="control">
<a class="button is-primary" href="{% url 'election.admin' election.pk %}"> <a class="button is-primary" href="{% url 'election.admin' election.pk %}">
<span class="icon is-small"> <span class="icon is-small">
@ -64,5 +66,37 @@
</form> </form>
</div> </div>
</div> </div>
<br>
{# Liste des votant·e·s #}
{% if voters %}
<h3 class="subtitle">{% trans "Liste des votant·e·s pour cette élection" %}</h3>
<hr>
<div class="columns is-centered">
<div class="column is-two-thirds">
<table class="table is-fullwidth is-bordered is-striped has-text-centered">
<thead>
<tr>
<th>{% trans "Login" %}</th>
<th>{% trans "Nom" %}</th>
<th>{% trans "Email" %}</th>
</tr>
</thead>
<tbody>
{% for v in voters %}
<tr>
<td>{{ v.base_username }}</td>
<td>{{ v.full_name }}</td>
<td>{{ v.email }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
{% endblock %} {% endblock %}

View file

@ -97,7 +97,7 @@ class ElectionUploadVotersView(CreatorOnlyEditMixin, SuccessMessageMixin, FormVi
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["voters"] = self.object.registered_voters context["voters"] = self.object.registered_voters.all()
return context return context
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):