diff --git a/README.md b/README.md index ddfa177c..0d5d0e54 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/bda/admin.py b/bda/admin.py index 3495d9ae..975c71ab 100644 --- a/bda/admin.py +++ b/bda/admin.py @@ -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 diff --git a/bda/templates/bda-participants.html b/bda/templates/bda-participants.html new file mode 100644 index 00000000..c21d4248 --- /dev/null +++ b/bda/templates/bda-participants.html @@ -0,0 +1,56 @@ +{% extends "base_title.html" %} + +{% block realcontent %} +

{{ spectacle }}

+ + + + + + + + + + + + {% for participant in participants %} + + + + + + + + + + {% endfor %} +
NomIdentifiantPlacesAdresse MailPayéDonné
{{participant.name}}{{participant.username}}{{participant.nb_places}} place{{participant.nb_places|pluralize}}{{participant.email}} +
+ {% if participant.paid %}Oui{% else %}Non{%endif%} +
+
+
+ {% if participant.given %}Oui{% else %}Non{%endif%} +
+
+
+ + +
+ + + + + +{% endblock %} diff --git a/bda/templates/spectacle_list.html b/bda/templates/spectacle_list.html index d707dde4..752a9315 100644 --- a/bda/templates/spectacle_list.html +++ b/bda/templates/spectacle_list.html @@ -1,11 +1,16 @@ {% extends "base_title.html" %} {% block realcontent %} -

Spectacles

+

{{tirage_name}}

+

Liste des spectacles

+

Exports

+ {% endblock %} diff --git a/bda/views.py b/bda/views.py index 32e62d30..ddb1b640 100644 --- a/bda/views.py +++ b/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 diff --git a/gestioncof/admin.py b/gestioncof/admin.py index 785ab6a2..03cb3b33 100644 --- a/gestioncof/admin.py +++ b/gestioncof/admin.py @@ -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') diff --git a/gestioncof/forms.py b/gestioncof/forms.py index 751755b4..a470face 100644 --- a/gestioncof/forms.py +++ b/gestioncof/forms.py @@ -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") diff --git a/gestioncof/templates/home.html b/gestioncof/templates/home.html index f0aecebc..52c0ebfd 100644 --- a/gestioncof/templates/home.html +++ b/gestioncof/templates/home.html @@ -63,6 +63,12 @@
  • Sondage : {{ survey.title }}
  • {% endfor %}
    +

    Gestion tirages BDA

    + {% for tirage in open_tirages %} +
  • {{ tirage.title }}
  • + {% endfor %} + +
  • Liens utiles du COF
  • Liens utiles BdA
  • diff --git a/gestioncof/templates/petits_cours_demandes_list.html b/gestioncof/templates/petits_cours_demandes_list.html index b3115815..101da253 100644 --- a/gestioncof/templates/petits_cours_demandes_list.html +++ b/gestioncof/templates/petits_cours_demandes_list.html @@ -20,7 +20,7 @@ {% for matiere in demande.matieres.all %}{% if forloop.counter0 > 0 %}, {% endif %}{{ matiere }}{% endfor %} {{ demande.created|date:"d E Y" }} - {% if demande.traitee_par %}{{ demande.traitee_par.username }}{% else %}{% endif %} + {% if demande.traitee_par %}{{ demande.traitee_par.username }}{% else %}{% endif %} Détails {% endfor %} diff --git a/gestioncof/templates/utile_bda.html b/gestioncof/templates/utile_bda.html index 5f4f383a..8948de97 100644 --- a/gestioncof/templates/utile_bda.html +++ b/gestioncof/templates/utile_bda.html @@ -10,14 +10,4 @@
  • BdA diffusion
  • BdA revente
  • -

    Tirages

    - {% for tirage in tirages %} -

    {{ tirage.title }}

    - - {% endfor %} {% endblock %} diff --git a/gestioncof/templatetags/utils.py b/gestioncof/templatetags/utils.py index 9c439dd3..c8bd96ea 100644 --- a/gestioncof/templatetags/utils.py +++ b/gestioncof/templatetags/utils.py @@ -34,3 +34,5 @@ def highlight_clipper(clipper, q): else: text = clipper.username return highlight_text(text, q) + + diff --git a/gestioncof/views.py b/gestioncof/views.py index 963fd5f5..70084e14 100644 --- a/gestioncof/views.py +++ b/gestioncof/views.py @@ -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)