forked from DGNum/gestioCOF
Merge branch 'master' into Kerl/use_django_custommail
This commit is contained in:
commit
993b8ae87b
968 changed files with 9176 additions and 79623 deletions
22
bda/views.py
22
bda/views.py
|
@ -11,13 +11,12 @@ from custommail.shortcuts import (
|
|||
from django.shortcuts import render, get_object_or_404
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db import models, transaction
|
||||
from django.db.models import Count, Q
|
||||
from django.core import serializers
|
||||
from django.db.models import Count, Q, Sum
|
||||
from django.forms.models import inlineformset_factory
|
||||
from django.http import HttpResponseBadRequest, HttpResponseRedirect
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.conf import settings
|
||||
|
||||
from django.utils import timezone
|
||||
from django.views.generic.list import ListView
|
||||
|
||||
|
@ -25,13 +24,19 @@ from gestioncof.decorators import cof_required, buro_required
|
|||
from bda.models import Spectacle, Participant, ChoixSpectacle, Attribution,\
|
||||
Tirage, SpectacleRevente
|
||||
from bda.algorithm import Algorithm
|
||||
|
||||
from bda.forms import BaseBdaFormSet, TokenForm, ResellForm, AnnulForm,\
|
||||
InscriptionReventeForm
|
||||
|
||||
|
||||
@cof_required
|
||||
def etat_places(request, tirage_id):
|
||||
"""
|
||||
Résumé des spectacles d'un tirage avec pour chaque spectacle :
|
||||
- Le nombre de places en jeu
|
||||
- Le nombre de demandes
|
||||
- Le ratio demandes/places
|
||||
Et le total de toutes les demandes
|
||||
"""
|
||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||
spectacles1 = ChoixSpectacle.objects \
|
||||
.filter(spectacle__tirage=tirage) \
|
||||
|
@ -63,9 +68,14 @@ def etat_places(request, tirage_id):
|
|||
spectacles_dict[spectacle["spectacle"]].ratio = \
|
||||
spectacles_dict[spectacle["spectacle"]].total / \
|
||||
spectacles_dict[spectacle["spectacle"]].slots
|
||||
total += spectacle["total"]
|
||||
return render(request, "etat-places.html",
|
||||
{"spectacles": spectacles, "total": total, 'tirage': tirage})
|
||||
total += 2*spectacle["total"]
|
||||
context = {
|
||||
"proposed": tirage.spectacle_set.aggregate(Sum('slots'))['slots__sum'],
|
||||
"spectacles": spectacles,
|
||||
"total": total,
|
||||
'tirage': tirage
|
||||
}
|
||||
return render(request, "bda/etat-places.html", context)
|
||||
|
||||
|
||||
def _hash_queryset(queryset):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue