Merge branch 'Aufinal/liste_spectacles' into Aufinal/view_spectacles

This commit is contained in:
ludo 2016-06-15 20:36:00 +02:00
commit 732f4b247d
4 changed files with 17 additions and 27 deletions

View file

@ -16,18 +16,18 @@
</thead> </thead>
{% for participant in participants %} {% for participant in participants %}
<tr> <tr>
<td>{{participant.user.get_full_name}}</td> <td>{{participant.name}}</td>
<td>{{participant.user.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:",s"}}</td>
<td>{{participant.user.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%}>
{{participant.paid|oui_ou_non}} {% if participant.paid %}Oui{% else %}Non{%endif%}
</div> </div>
</td> </td>
<td align="center"> <td align="center">
<div class={%if participant.given %}"greenratio"{%else%}"redratio"{%endif%}> <div class={%if participant.given %}"greenratio"{%else%}"redratio"{%endif%}>
{{participant.given|oui_ou_non}} {% if participant.given %}Oui{% else %}Non{%endif%}
</div> </div>
</td> </td>
@ -49,16 +49,15 @@
<td><input type="submit" value="Ajouter"></td> <td><input type="submit" value="Ajouter"></td>
</tr> </tr>
</table> </table>
<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.user.email}}, {%endfor%} {%for participant in participants %}{{participant.email}}, {%endfor%}
</pre> </pre>
<br> <br>
<button type="button" onclick="toggle('export-salle')">Afficher/Cacher liste noms</button> <button type="button" onclick="toggle('export-salle')">Afficher/Cacher liste noms</button>
<pre id="export-salle" style="display:none"> <pre id="export-salle" style="display:none">
{% for participant in participants %}{{participant.user.get_full_name}} {% if participant.nb_places == 2 %} {% for participant in participants %}{{participant.name}}{% if participant.nb_places == 2 %}
{{participant.user.get_full_name}}{%endif%} {{participant.name}}{%endif%}
{% endfor %} {% endfor %}
</pre> </pre>

View file

@ -1,16 +1,14 @@
{% extends "base_title.html" %} {% extends "base_title.html" %}
{% block realcontent %} {% block realcontent %}
<h1><strong>{{tirage_name}}</strong></h1> <h2><strong>{{tirage_name}}</strong></h2>
<br> <h3>Liste des spectacles</h3>
<h2>Liste des spectacles</h2>
<ul> <ul>
{% for spectacle in object_list %} {% for spectacle in object_list %}
<li><a href="{% url 'bda-spectacle' tirage_id spectacle.id %}">{{ spectacle }}</a></li> <li><a href="{% url 'bda-spectacle' tirage_id spectacle.id %}">{{ spectacle }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
<br> <h3> Exports </h3>
<h2> Exports </h2>
<ul> <ul>
<li><a href="{% url 'bda-unpaid' tirage_id %}">Mailing list impayés</a> <li><a href="{% url 'bda-unpaid' tirage_id %}">Mailing list impayés</a>
<li><a href="{% url 'bda-liste-spectacles-ics' tirage_id %}">Calendrier des spectacles (.ics)</a> <li><a href="{% url 'bda-liste-spectacles-ics' tirage_id %}">Calendrier des spectacles (.ics)</a>

View file

@ -298,14 +298,13 @@ def spectacle(request, tirage_id, spectacle_id):
participants = {} participants = {}
for attrib in attributions: for attrib in attributions:
participant = attrib.participant participant = attrib.participant
participant.given = attrib.given 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:
participant.nb_places = 1 participants[participant.id] = participant_info
participants[participant.id]=participant
return render(request, "bda-participants.html", {"spectacle": spectacle, "participants": participants.values()}) return render(request, "bda-participants.html", {"spectacle": spectacle, "participants": sorted(participants.values(), key=lambda part: part['lastname'])})
@buro_required @buro_required
def add_attrib(request, tirage_id, spectacle_id): def add_attrib(request, tirage_id, spectacle_id):

View file

@ -35,9 +35,3 @@ def highlight_clipper(clipper, q):
text = clipper.username text = clipper.username
return highlight_text(text, q) return highlight_text(text, q)
@register.filter
def oui_ou_non(b):
if b:
return "Oui"
else:
return "Non"