From 0def28e06d7c21f1fd6c2bf4e12a549416a5bc3b Mon Sep 17 00:00:00 2001 From: ludo Date: Sun, 12 Jun 2016 18:36:21 +0200 Subject: [PATCH] =?UTF-8?q?Change=20la=20vue=20bda.views.spectacle=20:=20d?= =?UTF-8?q?onne=20plus=20d'informations=20=C3=A0=20la=20page=20bda-partici?= =?UTF-8?q?pants.html,=20et=20g=C3=A9n=C3=A8re=20une=20liste=20de=20partic?= =?UTF-8?q?ipants=20sans=20doublons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bda/views.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/bda/views.py b/bda/views.py index 41c3c94d..bdc74322 100644 --- a/bda/views.py +++ b/bda/views.py @@ -292,8 +292,18 @@ def revente(request, tirage_id): 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}) - + attributions = spectacle.attribues.all() + participants = {} + for attrib in attributions: + participant = attrib.participant + participant.given = attrib.given + if (participant.id in participants): + participants[participant.id].nb_places = 2 + else: + participant.nb_places = 1 + participants[participant.id]=participant + + return render(request, "bda-participants.html", {"spectacle": spectacle, "participants": participants.values()}) class SpectacleListView(ListView): model = Spectacle @@ -305,6 +315,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