Nettoyage du code

This commit is contained in:
Martin Pépin 2016-06-06 11:11:33 +02:00
parent ad145ec70f
commit 366daf7240

View file

@ -25,14 +25,18 @@ from bda.forms import BaseBdaFormSet, TokenForm, ResellForm
@cof_required @cof_required
def etat_places(request, tirage_id): def etat_places(request, tirage_id):
tirage = get_object_or_404(Tirage, id=tirage_id) tirage = get_object_or_404(Tirage, id=tirage_id)
spectacles1 = ChoixSpectacle.objects.filter(spectacle__tirage=tirage spectacles1 = ChoixSpectacle.objects \
).filter(double_choice="1" .filter(spectacle__tirage=tirage) \
).all().values('spectacle','spectacle__title' .filter(double_choice="1") \
).annotate(total=models.Count('spectacle')) .all() \
spectacles2 = ChoixSpectacle.objects.filter(spectacle__tirage=tirage .values('spectacle','spectacle__title') \
).exclude(double_choice="1" .annotate(total=models.Count('spectacle'))
).all().values('spectacle','spectacle__title' spectacles2 = ChoixSpectacle.objects \
).annotate(total=models.Count('spectacle')) .filter(spectacle__tirage=tirage) \
.exclude(double_choice="1") \
.all() \
.values('spectacle','spectacle__title') \
.annotate(total=models.Count('spectacle'))
spectacles = Spectacle.objects.filter(tirage=tirage).all() spectacles = Spectacle.objects.filter(tirage=tirage).all()
spectacles_dict = {} spectacles_dict = {}
total = 0 total = 0