forked from DGNum/gestioCOF
Merge branch 'Aufinal/liste_spectacles' into 'master'
Création d'une vue par spectacle avec diverses informations Ce patch déplace les outils de gestion de tirage qui étaient sur <code>gestioncof/utile_bda</code> : il crée un lien par tirage sur la page d'accueil, qui pointe vers <code>bda/spectacles/\<tirage_id\></code>. Sur cette page se trouvent la liste des spectacles, un export du calendrier en .ics, et un export de la liste des mails des impayés ; les spectacles pointent vers <code>bda/spectacles/\<tirage_id\>/\<spectacle_id\></code>, qui contient : - la liste des participants, avec adresse mail, et payé/place donnée - un bouton pour afficher la liste des mails des participants (sans doublons) - un bouton pour afficher la liste des noms à envoyer aux salles (avec doublons) See merge request !34
This commit is contained in:
commit
f00e081b0b
6 changed files with 92 additions and 14 deletions
56
bda/templates/bda-participants.html
Normal file
56
bda/templates/bda-participants.html
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{% extends "base_title.html" %}
|
||||||
|
|
||||||
|
{% block realcontent %}
|
||||||
|
<h2>{{ spectacle }}</h2>
|
||||||
|
<table class='etat-bda' align="center">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Nom</th>
|
||||||
|
<th>Identifiant</th>
|
||||||
|
<th>Places</th>
|
||||||
|
<th>Adresse Mail</th>
|
||||||
|
<th>Payé</th>
|
||||||
|
<th>Donné</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
{% for participant in participants %}
|
||||||
|
<tr>
|
||||||
|
<td>{{participant.name}}</td>
|
||||||
|
<td>{{participant.username}}</td>
|
||||||
|
<td>{{participant.nb_places}} place{{participant.nb_places|pluralize}}</td>
|
||||||
|
<td>{{participant.email}}</td>
|
||||||
|
<td>
|
||||||
|
<div class={%if participant.paid %}"greenratio"{%else%}"redratio"{%endif%}>
|
||||||
|
{% if participant.paid %}Oui{% else %}Non{%endif%}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<div class={%if participant.given %}"greenratio"{%else%}"redratio"{%endif%}>
|
||||||
|
{% if participant.given %}Oui{% else %}Non{%endif%}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
<button type="button" onclick="toggle('export-mails')">Afficher/Cacher mails participants</button>
|
||||||
|
<pre id="export-mails" style="display:none">
|
||||||
|
{%for participant in participants %}{{participant.email}}, {%endfor%}
|
||||||
|
</pre>
|
||||||
|
<br>
|
||||||
|
<button type="button" onclick="toggle('export-salle')">Afficher/Cacher liste noms</button>
|
||||||
|
<pre id="export-salle" style="display:none">
|
||||||
|
{% for participant in participants %}{{participant.name}}{% if participant.nb_places == 2 %}
|
||||||
|
{{participant.name}}{%endif%}
|
||||||
|
{% endfor %}
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function toggle(id) {
|
||||||
|
var pre = document.getElementById(id) ;
|
||||||
|
pre.style.display = pre.style.display == "none" ? "block" : "none" ;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{% endblock %}
|
|
@ -1,11 +1,16 @@
|
||||||
{% extends "base_title.html" %}
|
{% extends "base_title.html" %}
|
||||||
|
|
||||||
{% block realcontent %}
|
{% block realcontent %}
|
||||||
<h1><strong>Spectacles</strong></h1>
|
<h2><strong>{{tirage_name}}</strong></h2>
|
||||||
|
<h3>Liste des spectacles</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{% url 'bda-unpaid' tirage_id %}">Pas payé</a></li>
|
|
||||||
{% 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>
|
||||||
|
<h3> Exports </h3>
|
||||||
|
<ul>
|
||||||
|
<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>
|
||||||
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
23
bda/views.py
23
bda/views.py
|
@ -291,9 +291,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)
|
||||||
return render(request, "bda-emails.html", {"spectacle": spectacle})
|
attributions = spectacle.attribues.all()
|
||||||
|
participants = {}
|
||||||
|
for attrib in attributions:
|
||||||
|
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}
|
||||||
|
if participant.id in participants:
|
||||||
|
participants[participant.id]['nb_places'] += 1
|
||||||
|
else:
|
||||||
|
participants[participant.id] = participant_info
|
||||||
|
|
||||||
|
participants_info = sorted(participants.values(),
|
||||||
|
key=lambda part: part['lastname'])
|
||||||
|
return render(request, "bda-participants.html",
|
||||||
|
{"spectacle": spectacle, "participants": participants_info})
|
||||||
|
|
||||||
class SpectacleListView(ListView):
|
class SpectacleListView(ListView):
|
||||||
model = Spectacle
|
model = Spectacle
|
||||||
|
@ -305,6 +323,7 @@ class SpectacleListView(ListView):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(SpectacleListView, self).get_context_data(**kwargs)
|
context = super(SpectacleListView, self).get_context_data(**kwargs)
|
||||||
context['tirage_id'] = self.tirage.id
|
context['tirage_id'] = self.tirage.id
|
||||||
|
context['tirage_name'] = self.tirage.title
|
||||||
return context
|
return context
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
|
|
|
@ -63,6 +63,12 @@
|
||||||
<li><a href="{% url "gestioncof.views.survey_status" survey.id %}">Sondage : {{ survey.title }}</a></li>
|
<li><a href="{% url "gestioncof.views.survey_status" survey.id %}">Sondage : {{ survey.title }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<br>
|
<br>
|
||||||
|
<h3>Gestion tirages BDA</h3>
|
||||||
|
{% for tirage in open_tirages %}
|
||||||
|
<li><a href="{% url "bda-liste-spectacles" tirage.id %}"> {{ tirage.title }}</a></li>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<br>
|
||||||
<li><a href="{% url "gestioncof.views.utile_cof" %}">Liens utiles du COF</a></li>
|
<li><a href="{% url "gestioncof.views.utile_cof" %}">Liens utiles du COF</a></li>
|
||||||
<li><a href="{% url "gestioncof.views.utile_bda" %}">Liens utiles BdA</a></li>
|
<li><a href="{% url "gestioncof.views.utile_bda" %}">Liens utiles BdA</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -10,14 +10,4 @@
|
||||||
<li><a href="{% url 'gestioncof.views.liste_bdadiff' %}">BdA diffusion</a></li>
|
<li><a href="{% url 'gestioncof.views.liste_bdadiff' %}">BdA diffusion</a></li>
|
||||||
<li><a href="{% url 'gestioncof.views.liste_bdarevente' %}">BdA revente</a></li>
|
<li><a href="{% url 'gestioncof.views.liste_bdarevente' %}">BdA revente</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<h3>Tirages</h3>
|
|
||||||
{% for tirage in tirages %}
|
|
||||||
<h4>{{ tirage.title }}</h4>
|
|
||||||
<ul>
|
|
||||||
<li><a href="{% url 'bda.views.etat_places' tirage.id %}">Etat des voeux</a></li>
|
|
||||||
<li><a href="{% url 'bda-liste-spectacles' tirage.id %}">Mailing list par spectacle</a></li>
|
|
||||||
<li><a href="{% url 'bda.views.unpaid' tirage.id %}">Mailing list des impayés</a></li>
|
|
||||||
<li><a href="{% url 'bda-liste-spectacles-ics' tirage.id %}">Calendrier des spectacles (.ics)</a></li>
|
|
||||||
</ul>
|
|
||||||
{% endfor %}
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -34,3 +34,5 @@ def highlight_clipper(clipper, q):
|
||||||
else:
|
else:
|
||||||
text = clipper.username
|
text = clipper.username
|
||||||
return highlight_text(text, q)
|
return highlight_text(text, q)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue