Merge branch 'master' into Kerl/mails_rappel
This commit is contained in:
commit
e318474567
12 changed files with 118 additions and 24 deletions
|
@ -162,3 +162,10 @@ Pour mettre à jour les paquets Python, utiliser la commande suivante :
|
|||
Pour mettre à jour les modèles après une migration, il faut ensuite faire :
|
||||
|
||||
python manage.py migrate
|
||||
|
||||
|
||||
## Documentation utilisateur
|
||||
|
||||
Une brève documentation utilisateur pour se faliliariser plus vite avec l'outil
|
||||
est accessible sur le
|
||||
[wiki](https://git.eleves.ens.fr/cof-geek/gestioCOF/wikis/home).
|
||||
|
|
|
@ -28,7 +28,6 @@ class AttributionInlineListing(admin.TabularInline):
|
|||
return qs.filter(spectacle__listing=True)
|
||||
|
||||
class ParticipantAdmin(admin.ModelAdmin):
|
||||
#inlines = [ChoixSpectacleInline]
|
||||
inlines = [
|
||||
AttributionInline,
|
||||
AttributionInlineListing]
|
||||
|
@ -45,8 +44,9 @@ class ParticipantAdmin(admin.ModelAdmin):
|
|||
else: return u"0 €"
|
||||
total.admin_order_field = "total"
|
||||
total.short_description = "Total à payer"
|
||||
list_display = ("user", "nb_places", "total", "paid", "paymenttype")
|
||||
list_filter = ("paid",)
|
||||
list_display = ("user", "nb_places", "total", "paid", "paymenttype",
|
||||
"tirage")
|
||||
list_filter = ("paid", "tirage")
|
||||
search_fields = ('user__username', 'user__first_name', 'user__last_name')
|
||||
actions = ['send_attribs',]
|
||||
actions_on_bottom = True
|
||||
|
|
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" %}
|
||||
|
||||
{% block realcontent %}
|
||||
<h1><strong>Spectacles</strong></h1>
|
||||
<h2><strong>{{tirage_name}}</strong></h2>
|
||||
<h3>Liste des spectacles</h3>
|
||||
<ul>
|
||||
<li><a href="{% url 'bda-unpaid' tirage_id %}">Pas payé</a></li>
|
||||
{% for spectacle in object_list %}
|
||||
<li><a href="{% url 'bda-spectacle' tirage_id spectacle.id %}">{{ spectacle }}</a></li>
|
||||
{% endfor %}
|
||||
</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 %}
|
||||
|
|
27
bda/views.py
27
bda/views.py
|
@ -237,7 +237,9 @@ def do_tirage(request, tirage_id):
|
|||
# FIXME: Établir les conditions de validations (formulaire ?)
|
||||
# cf. issue #32
|
||||
if False:
|
||||
Attribution.objects.all().delete()
|
||||
Attribution.objects.filter(
|
||||
spectacle__tirage=tirage_elt
|
||||
).delete()
|
||||
for (show, members, _) in results:
|
||||
for (member, _, _, _) in members:
|
||||
attrib = Attribution(spectacle=show, participant=member)
|
||||
|
@ -291,9 +293,27 @@ def revente(request, tirage_id):
|
|||
@buro_required
|
||||
def spectacle(request, tirage_id, spectacle_id):
|
||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||
spectacle = get_object_or_404(Spectacle, id = spectacle_id, tirage=tirage)
|
||||
return render(request, "bda-emails.html", {"spectacle": spectacle})
|
||||
spectacle = get_object_or_404(Spectacle, id=spectacle_id, tirage=tirage)
|
||||
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):
|
||||
model = Spectacle
|
||||
|
@ -305,6 +325,7 @@ class SpectacleListView(ListView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super(SpectacleListView, self).get_context_data(**kwargs)
|
||||
context['tirage_id'] = self.tirage.id
|
||||
context['tirage_name'] = self.tirage.title
|
||||
return context
|
||||
|
||||
@buro_required
|
||||
|
|
|
@ -154,6 +154,13 @@ class PetitCoursAttributionCounterAdmin(admin.ModelAdmin):
|
|||
list_display = ('user','matiere','count',)
|
||||
list_filter = ('matiere',)
|
||||
search_fields = ('user__username', 'user__first_name', 'user__last_name', 'user__email', 'matiere__name')
|
||||
actions = ['reset',]
|
||||
actions_on_bottom = True
|
||||
|
||||
def reset(self, request, queryset):
|
||||
queryset.update(count=0)
|
||||
reset.short_description = u"Remise à zéro du compteur"
|
||||
|
||||
|
||||
class PetitCoursDemandeAdmin(admin.ModelAdmin):
|
||||
list_display = ('name','email','agrege_requis','niveau','created','traitee','processed')
|
||||
|
|
|
@ -79,6 +79,11 @@ class SurveyForm(forms.Form):
|
|||
field.question_id = question.id
|
||||
self.fields["question_%d" % question.id] = field
|
||||
|
||||
def answers(self):
|
||||
for name, value in self.cleaned_data.items():
|
||||
if name.startswith('question_'):
|
||||
yield (self.fields[name].question_id, value)
|
||||
|
||||
class SurveyStatusFilterForm(forms.Form):
|
||||
def __init__(self, *args, **kwargs):
|
||||
survey = kwargs.pop("survey")
|
||||
|
|
|
@ -63,6 +63,12 @@
|
|||
<li><a href="{% url "gestioncof.views.survey_status" survey.id %}">Sondage : {{ survey.title }}</a></li>
|
||||
{% endfor %}
|
||||
<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_bda" %}">Liens utiles BdA</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<td>{% for matiere in demande.matieres.all %}{% if forloop.counter0 > 0 %}, {% endif %}{{ matiere }}{% endfor %}</td>
|
||||
<td>{{ demande.created|date:"d E Y" }}</td>
|
||||
<td style="text-align: center;"><img src="{% if demande.traitee %}{% static "images/yes.png" %}{% else %}{% static "images/no.png" %}{% endif %}" /></td>
|
||||
<td>{% if demande.traitee_par %}{{ demande.traitee_par.username }}{% else %}<img src="{% static "/images/none.png" %}" />{% endif %}</td>
|
||||
<td>{% if demande.traitee_par %}{{ demande.traitee_par.username }}{% else %}<img src="{% static "images/none.png" %}" />{% endif %}</td>
|
||||
<td><a href="{% url "petits-cours-demande-details" demande.id %}" class="see_detail">Détails</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -10,14 +10,4 @@
|
|||
<li><a href="{% url 'gestioncof.views.liste_bdadiff' %}">BdA diffusion</a></li>
|
||||
<li><a href="{% url 'gestioncof.views.liste_bdarevente' %}">BdA revente</a></li>
|
||||
</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 %}
|
||||
|
|
|
@ -34,3 +34,5 @@ def highlight_clipper(clipper, q):
|
|||
else:
|
||||
text = clipper.username
|
||||
return highlight_text(text, q)
|
||||
|
||||
|
||||
|
|
|
@ -59,11 +59,6 @@ def logout(request):
|
|||
else:
|
||||
return redirect("django.contrib.auth.views.logout")
|
||||
|
||||
def answers(self):
|
||||
for name, value in self.cleaned_data.items():
|
||||
if name.startswith('question_'):
|
||||
yield (self.fields[name].question_id, value)
|
||||
|
||||
@login_required
|
||||
def survey(request, survey_id):
|
||||
survey = get_object_or_404(Survey, id = survey_id)
|
||||
|
|
Loading…
Reference in a new issue