forked from DGNum/gestioCOF
espaces autour des =, code sur 80 colonnes
This commit is contained in:
parent
bf4cb4c9ee
commit
5cf89102a9
1 changed files with 13 additions and 4 deletions
17
bda/views.py
17
bda/views.py
|
@ -291,18 +291,27 @@ def revente(request, tirage_id):
|
||||||
@buro_required
|
@buro_required
|
||||||
def spectacle(request, tirage_id, spectacle_id):
|
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
|
||||||
participant_info = {'lastname':participant.user.last_name, 'name': participant.user.get_full_name, 'username':participant.user.username, 'email':participant.user.email, 'given':attrib.given, 'paid':participant.paid, 'nb_places':1}
|
participant_info = {'lastname':participant.user.last_name,
|
||||||
|
'name': participant.user.get_full_name,
|
||||||
|
'username':participant.user.username,
|
||||||
|
'email':participant.user.email,
|
||||||
|
'given':attrib.given,
|
||||||
|
'paid':participant.paid,
|
||||||
|
'nb_places':1}
|
||||||
if participant.id in participants:
|
if participant.id in participants:
|
||||||
participants[participant.id]['nb_places'] = 2
|
participants[participant.id]['nb_places'] = 2
|
||||||
else:
|
else:
|
||||||
participants[participant.id] = participant_info
|
participants[participant.id] = participant_info
|
||||||
|
|
||||||
return render(request, "bda-participants.html", {"spectacle": spectacle, "participants": sorted(participants.values(), key=lambda part: part['lastname'])})
|
participants_info = sorted(participants.values(),
|
||||||
|
key=lambda part: part['lastname'])
|
||||||
|
return render(request, "bda-participants.html",
|
||||||
|
{"spectacle": spectacle, "participants": participants_info})
|
||||||
|
|
||||||
class SpectacleListView(ListView):
|
class SpectacleListView(ListView):
|
||||||
model = Spectacle
|
model = Spectacle
|
||||||
|
|
Loading…
Reference in a new issue