Merge branch 'Aufinal/liste_spectacles' into Aufinal/view_spectacles

This commit is contained in:
ludo 2016-06-15 21:54:03 +02:00
commit c7c5b5b40f
2 changed files with 16 additions and 7 deletions

View file

@ -1,5 +1,4 @@
{% extends "base_title.html" %} {% extends "base_title.html" %}
{% load utils %}
{% block realcontent %} {% block realcontent %}
<h2>{{ spectacle }}</h2> <h2>{{ spectacle }}</h2>
@ -7,7 +6,7 @@
<thead> <thead>
<tr> <tr>
<th>Nom</th> <th>Nom</th>
<th>Clipper</th> <th>Identifiant</th>
<th>Places</th> <th>Places</th>
<th>Adresse Mail</th> <th>Adresse Mail</th>
<th>Payé</th> <th>Payé</th>
@ -18,7 +17,7 @@
<tr> <tr>
<td>{{participant.name}}</td> <td>{{participant.name}}</td>
<td>{{participant.username}}</td> <td>{{participant.username}}</td>
<td>{{participant.nb_places}} place{{participant.nb_places|pluralize:",s"}}</td> <td>{{participant.nb_places}} place{{participant.nb_places|pluralize}}</td>
<td>{{participant.email}}</td> <td>{{participant.email}}</td>
<td> <td>
<div class={%if participant.paid %}"greenratio"{%else%}"redratio"{%endif%}> <div class={%if participant.paid %}"greenratio"{%else%}"redratio"{%endif%}>
@ -49,6 +48,7 @@
<td><input type="submit" value="Ajouter"></td> <td><input type="submit" value="Ajouter"></td>
</tr> </tr>
</table> </table>
<br>
<button type="button" onclick="toggle('export-mails')">Afficher/Cacher mails participants</button> <button type="button" onclick="toggle('export-mails')">Afficher/Cacher mails participants</button>
<pre id="export-mails" style="display:none"> <pre id="export-mails" style="display:none">
{%for participant in participants %}{{participant.email}}, {%endfor%} {%for participant in participants %}{{participant.email}}, {%endfor%}

View file

@ -293,18 +293,27 @@ def revente(request, tirage_id):
@buro_required @buro_required
def spectacle(request, tirage_id, spectacle_id): def spectacle(request, tirage_id, spectacle_id):
tirage = get_object_or_404(Tirage, id=tirage_id) tirage = get_object_or_404(Tirage, id=tirage_id)
spectacle = get_object_or_404(Spectacle, id = spectacle_id, tirage=tirage) spectacle = get_object_or_404(Spectacle, id=spectacle_id, tirage=tirage)
attributions = spectacle.attribues.all() attributions = spectacle.attribues.all()
participants = {} participants = {}
for attrib in attributions: for attrib in attributions:
participant = attrib.participant participant = attrib.participant
participant_info = {'lastname':participant.user.last_name, 'name': participant.user.get_full_name, 'username':participant.user.username, 'email':participant.user.email, 'given':attrib.given, 'paid':participant.paid, 'nb_places':1} participant_info = {'lastname':participant.user.last_name,
'name': participant.user.get_full_name,
'username':participant.user.username,
'email':participant.user.email,
'given':attrib.given,
'paid':participant.paid,
'nb_places':1}
if participant.id in participants: if participant.id in participants:
participants[participant.id]['nb_places'] = 2 participants[participant.id]['nb_places'] = 2
else: else:
participants[participant.id] = participant_info participants[participant.id] = participant_info
return render(request, "bda-participants.html", {"spectacle": spectacle, "participants": sorted(participants.values(), key=lambda part: part['lastname'])}) participants_info = sorted(participants.values(),
key=lambda part: part['lastname'])
return render(request, "bda-participants.html",
{"spectacle": spectacle, "participants": participants_info})
@buro_required @buro_required
def add_attrib(request, tirage_id, spectacle_id): def add_attrib(request, tirage_id, spectacle_id):