fix élimination des doublons

This commit is contained in:
ludo 2016-06-10 18:04:02 +02:00
parent 96195f1e81
commit e93e60ec84

View file

@ -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