forked from DGNum/gestioCOF
Mise en forme
- Suppression des espaces autour des signes `=` dans les keyword arguments. Cf [PEP8](https://www.python.org/dev/peps/pep-0008/) - Suppression d'une virgule inutile.
This commit is contained in:
parent
8121dde36a
commit
ae3677701d
1 changed files with 15 additions and 15 deletions
30
bda/views.py
30
bda/views.py
|
@ -24,8 +24,8 @@ from bda.forms import BaseBdaFormSet, TokenForm, ResellForm
|
||||||
@cof_required
|
@cof_required
|
||||||
def etat_places(request, tirage):
|
def etat_places(request, tirage):
|
||||||
all_spectacles = ChoixSpectacle.objects.filter(tirage = tirage)
|
all_spectacles = ChoixSpectacle.objects.filter(tirage = tirage)
|
||||||
spectacles1 = all_spectacles.filter(double_choice = "1").all().values('spectacle','spectacle__title').annotate(total = models.Count('spectacle'))
|
spectacles1 = all_spectacles.filter(double_choice="1").all().values('spectacle','spectacle__title').annotate(total=models.Count('spectacle'))
|
||||||
spectacles2 = all_spectacles.exclude(double_choice = "1").all().values('spectacle','spectacle__title').annotate(total = models.Count('spectacle'))
|
spectacles2 = all_spectacles.exclude(double_choice="1").all().values('spectacle','spectacle__title').annotate(total=models.Count('spectacle'))
|
||||||
spectacles = Spectacle.objects.all()
|
spectacles = Spectacle.objects.all()
|
||||||
spectacles_dict = {}
|
spectacles_dict = {}
|
||||||
total = 0
|
total = 0
|
||||||
|
@ -51,8 +51,8 @@ def _hash_queryset(queryset):
|
||||||
|
|
||||||
@cof_required
|
@cof_required
|
||||||
def places(request, tirage):
|
def places(request, tirage):
|
||||||
participant, created = Participant.objects.get_or_create(user = request.user)
|
participant, created = Participant.objects.get_or_create(user=request.user)
|
||||||
places = participant.attribution_set.filter(tirage = tirage).order_by("spectacle__date", "spectacle").all()
|
places = participant.attribution_set.filter(tirage=tirage).order_by("spectacle__date", "spectacle").all()
|
||||||
total = sum([place.spectacle.price for place in places])
|
total = sum([place.spectacle.price for place in places])
|
||||||
filtered_places = []
|
filtered_places = []
|
||||||
places_dict = {}
|
places_dict = {}
|
||||||
|
@ -80,7 +80,7 @@ def places(request, tirage):
|
||||||
|
|
||||||
@cof_required
|
@cof_required
|
||||||
def places_ics(request, tirage):
|
def places_ics(request, tirage):
|
||||||
participant, created = Participant.objects.get_or_create(user = request.user)
|
participant, created = Participant.objects.get_or_create(user=request.user)
|
||||||
places = participant.attribution_set.filter(tirage=tirage).order_by("spectacle__date", "spectacle").all()
|
places = participant.attribution_set.filter(tirage=tirage).order_by("spectacle__date", "spectacle").all()
|
||||||
filtered_places = []
|
filtered_places = []
|
||||||
places_dict = {}
|
places_dict = {}
|
||||||
|
@ -102,30 +102,30 @@ def places_ics(request, tirage):
|
||||||
@cof_required
|
@cof_required
|
||||||
def inscription(request, tirage):
|
def inscription(request, tirage):
|
||||||
if datetime.now() > datetime(2025, 10, 4, 12, 00):
|
if datetime.now() > datetime(2025, 10, 4, 12, 00):
|
||||||
participant, created = Participant.objects.get_or_create(user = request.user)
|
participant, created = Participant.objects.get_or_create(user=request.user)
|
||||||
choices = participant.choixspectacle_set.order_by("priority").all()
|
choices = participant.choixspectacle_set.order_by("priority").all()
|
||||||
return render(request, "resume_inscription.html", {"error_title": "C'est fini !", "error_description": u"Tirage au sort dans la journée !", "choices": choices})
|
return render(request, "resume_inscription.html", {"error_title": "C'est fini !", "error_description": u"Tirage au sort dans la journée !", "choices": choices})
|
||||||
BdaFormSet = inlineformset_factory(Participant, ChoixSpectacle, fields =
|
BdaFormSet = inlineformset_factory(Participant, ChoixSpectacle,
|
||||||
("spectacle","double_choice","priority"), formset = BaseBdaFormSet)
|
fields=("spectacle","double_choice","priority"), formset=BaseBdaFormSet)
|
||||||
participant, created = Participant.objects.get_or_create(user = request.user)
|
participant, created = Participant.objects.get_or_create(user=request.user)
|
||||||
success = False
|
success = False
|
||||||
stateerror = False
|
stateerror = False
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
dbstate = _hash_queryset(participant.choixspectacle_set.all())
|
dbstate = _hash_queryset(participant.choixspectacle_set.all())
|
||||||
if "dbstate" in request.POST and dbstate != request.POST["dbstate"]:
|
if "dbstate" in request.POST and dbstate != request.POST["dbstate"]:
|
||||||
stateerror = True
|
stateerror = True
|
||||||
formset = BdaFormSet(instance = participant)
|
formset = BdaFormSet(instance=participant)
|
||||||
else:
|
else:
|
||||||
formset = BdaFormSet(request.POST, instance = participant)
|
formset = BdaFormSet(request.POST, instance=participant)
|
||||||
if formset.is_valid():
|
if formset.is_valid():
|
||||||
choix = formset.save(commit=False)
|
choix = formset.save(commit=False)
|
||||||
for c in choix:
|
for c in choix:
|
||||||
c.tirage = tirage
|
c.tirage = tirage
|
||||||
c.save()
|
c.save()
|
||||||
success = True
|
success = True
|
||||||
formset = BdaFormSet(instance = participant)
|
formset = BdaFormSet(instance=participant)
|
||||||
else:
|
else:
|
||||||
formset = BdaFormSet(instance = participant, )
|
formset = BdaFormSet(instance=participant)
|
||||||
dbstate = _hash_queryset(participant.choixspectacle_set.all())
|
dbstate = _hash_queryset(participant.choixspectacle_set.all())
|
||||||
total_price = 0
|
total_price = 0
|
||||||
for choice in participant.choixspectacle_set.filter(tirage=tirage).all():
|
for choice in participant.choixspectacle_set.filter(tirage=tirage).all():
|
||||||
|
@ -233,7 +233,7 @@ Contactez moi par email si vous êtes intéressé·e·s !
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def revente(request):
|
def revente(request):
|
||||||
participant, created = Participant.objects.get_or_create(user = request.user)
|
participant, created = Participant.objects.get_or_create(user=request.user)
|
||||||
if not participant.paid:
|
if not participant.paid:
|
||||||
return render(request, "bda-notpaid.html", {})
|
return render(request, "bda-notpaid.html", {})
|
||||||
if request.POST:
|
if request.POST:
|
||||||
|
@ -251,7 +251,7 @@ def spectacle(request, spectacle_id):
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
def unpaid(request):
|
def unpaid(request):
|
||||||
return render(request, "bda-unpaid.html", {"unpaid": Participant.objects.filter(paid = False).all()})
|
return render(request, "bda-unpaid.html", {"unpaid": Participant.objects.filter(paid=False).all()})
|
||||||
|
|
||||||
@buro_required
|
@buro_required
|
||||||
def liste_spectacles_ics(request, tirage):
|
def liste_spectacles_ics(request, tirage):
|
||||||
|
|
Loading…
Reference in a new issue