diff --git a/bda/views.py b/bda/views.py index 2161b682..2e405ec1 100644 --- a/bda/views.py +++ b/bda/views.py @@ -307,16 +307,17 @@ 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) attributions = spectacle.attribues.all() - participants = [] + participants = {} for attrib in attributions: participant = attrib.participant - if (participant in participants): - participant.nb_places = 2 + participant.given = attrib.given + if (participant.id in participants): + participants[participant.id].nb_places = 2 else: participant.nb_places = 1 - participants.append(participant) + participants[participant.id]=participant - return render(request, "bda-participants.html", {"spectacle": spectacle, "participants": participants}) + return render(request, "bda-participants.html", {"spectacle": spectacle, "participants": participants.values()}) class SpectacleListView(ListView): @@ -329,6 +330,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