fix élimination des doublons
This commit is contained in:
parent
96195f1e81
commit
e93e60ec84
1 changed files with 7 additions and 5 deletions
12
bda/views.py
12
bda/views.py
|
@ -307,16 +307,17 @@ def spectacle(request, tirage_id, spectacle_id):
|
||||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||||
spectacle = get_object_or_404(Spectacle, id = spectacle_id, tirage=tirage)
|
spectacle = get_object_or_404(Spectacle, id = spectacle_id, tirage=tirage)
|
||||||
attributions = spectacle.attribues.all()
|
attributions = spectacle.attribues.all()
|
||||||
participants = []
|
participants = {}
|
||||||
for attrib in attributions:
|
for attrib in attributions:
|
||||||
participant = attrib.participant
|
participant = attrib.participant
|
||||||
if (participant in participants):
|
participant.given = attrib.given
|
||||||
participant.nb_places = 2
|
if (participant.id in participants):
|
||||||
|
participants[participant.id].nb_places = 2
|
||||||
else:
|
else:
|
||||||
participant.nb_places = 1
|
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):
|
class SpectacleListView(ListView):
|
||||||
|
@ -329,6 +330,7 @@ class SpectacleListView(ListView):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(SpectacleListView, self).get_context_data(**kwargs)
|
context = super(SpectacleListView, self).get_context_data(**kwargs)
|
||||||
context['tirage_id'] = self.tirage.id
|
context['tirage_id'] = self.tirage.id
|
||||||
|
context['tirage_name'] = self.tirage.title
|
||||||
return context
|
return context
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
|
|
Loading…
Reference in a new issue