Merge branch 'master' into Kerl/mails_rappel

This commit is contained in:
Martin Pépin 2016-07-08 21:53:21 +02:00
commit d97708a2ee
12 changed files with 162 additions and 84 deletions

View file

@ -5,6 +5,7 @@ from __future__ import division
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.db import models
from django.db.models import Count
from django.core import serializers
from django.forms.models import inlineformset_factory
import hashlib
@ -302,11 +303,12 @@ def spectacle(request, tirage_id, spectacle_id):
'name': participant.user.get_full_name,
'username': participant.user.username,
'email': participant.user.email,
'given': attrib.given,
'given': int(attrib.given),
'paid': participant.paid,
'nb_places': 1}
if participant.id in participants:
participants[participant.id]['nb_places'] += 1
participants[participant.id]['nb_places'] += 1
participants[participant.id]['given'] += attrib.given
else:
participants[participant.id] = participant_info
@ -331,7 +333,9 @@ class SpectacleListView(ListView):
@buro_required
def unpaid(request, tirage_id):
tirage = get_object_or_404(Tirage, id=tirage_id)
unpaid = tirage.participant_set.filter(paid=False).all()
unpaid = tirage.participant_set \
.annotate(nb_attributions=Count('attribution')) \
.filter(paid=False, nb_attributions__gt=0).all()
return render(request, "bda-unpaid.html", {"unpaid": unpaid})
@buro_required