From 366daf7240013df79a899a270753b89f224a855b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Mon, 6 Jun 2016 11:11:33 +0200 Subject: [PATCH] Nettoyage du code --- bda/views.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/bda/views.py b/bda/views.py index c1b80189..a14380d8 100644 --- a/bda/views.py +++ b/bda/views.py @@ -25,14 +25,18 @@ from bda.forms import BaseBdaFormSet, TokenForm, ResellForm @cof_required def etat_places(request, tirage_id): tirage = get_object_or_404(Tirage, id=tirage_id) - spectacles1 = ChoixSpectacle.objects.filter(spectacle__tirage=tirage - ).filter(double_choice="1" - ).all().values('spectacle','spectacle__title' - ).annotate(total=models.Count('spectacle')) - spectacles2 = ChoixSpectacle.objects.filter(spectacle__tirage=tirage - ).exclude(double_choice="1" - ).all().values('spectacle','spectacle__title' - ).annotate(total=models.Count('spectacle')) + spectacles1 = ChoixSpectacle.objects \ + .filter(spectacle__tirage=tirage) \ + .filter(double_choice="1") \ + .all() \ + .values('spectacle','spectacle__title') \ + .annotate(total=models.Count('spectacle')) + spectacles2 = ChoixSpectacle.objects \ + .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_dict = {} total = 0