forked from DGNum/gestioCOF
Merge branch 'master' into Kerl/mails_rappel
This commit is contained in:
commit
e318474567
12 changed files with 118 additions and 24 deletions
27
bda/views.py
27
bda/views.py
|
@ -237,7 +237,9 @@ def do_tirage(request, tirage_id):
|
|||
# FIXME: Établir les conditions de validations (formulaire ?)
|
||||
# cf. issue #32
|
||||
if False:
|
||||
Attribution.objects.all().delete()
|
||||
Attribution.objects.filter(
|
||||
spectacle__tirage=tirage_elt
|
||||
).delete()
|
||||
for (show, members, _) in results:
|
||||
for (member, _, _, _) in members:
|
||||
attrib = Attribution(spectacle=show, participant=member)
|
||||
|
@ -291,9 +293,27 @@ def revente(request, tirage_id):
|
|||
@buro_required
|
||||
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})
|
||||
spectacle = get_object_or_404(Spectacle, id=spectacle_id, tirage=tirage)
|
||||
attributions = spectacle.attribues.all()
|
||||
participants = {}
|
||||
for attrib in attributions:
|
||||
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}
|
||||
if participant.id in participants:
|
||||
participants[participant.id]['nb_places'] += 1
|
||||
else:
|
||||
participants[participant.id] = participant_info
|
||||
|
||||
participants_info = sorted(participants.values(),
|
||||
key=lambda part: part['lastname'])
|
||||
return render(request, "bda-participants.html",
|
||||
{"spectacle": spectacle, "participants": participants_info})
|
||||
|
||||
class SpectacleListView(ListView):
|
||||
model = Spectacle
|
||||
|
@ -305,6 +325,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…
Add table
Add a link
Reference in a new issue