forked from DGNum/gestioCOF
Change la vue bda.views.spectacle : donne plus d'informations à la page bda-participants.html, et génère une liste de participants sans doublons
This commit is contained in:
parent
c81cad77e5
commit
0def28e06d
1 changed files with 13 additions and 2 deletions
15
bda/views.py
15
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
|
||||
|
|
Loading…
Reference in a new issue