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