forked from DGNum/gestioCOF
should have been in bda_shotgun
This commit is contained in:
parent
04c75036ad
commit
27464aaa93
13
bda/views.py
13
bda/views.py
|
@ -381,19 +381,8 @@ def list_revente(request, tirage_id):
|
||||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||||
participant, created = Participant.objects.get_or_create(
|
participant, created = Participant.objects.get_or_create(
|
||||||
user=request.user, tirage=tirage)
|
user=request.user, tirage=tirage)
|
||||||
spectacles = tirage.spectacle_set.filter(
|
|
||||||
date__gte=timezone.now())
|
|
||||||
shotgun = []
|
|
||||||
deja_revente = False
|
deja_revente = False
|
||||||
success = False
|
success = False
|
||||||
for spectacle in spectacles:
|
|
||||||
revente_objects = SpectacleRevente.objects.filter(
|
|
||||||
attribution__spectacle=spectacle,
|
|
||||||
soldTo__isnull=True,
|
|
||||||
shotgun=True)
|
|
||||||
if revente_objects.exists():
|
|
||||||
shotgun.append(spectacle)
|
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
form = InscriptionReventeForm(tirage, request.POST)
|
form = InscriptionReventeForm(tirage, request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
@ -419,7 +408,7 @@ def list_revente(request, tirage_id):
|
||||||
initial={'spectacles': participant.choicesrevente.all()})
|
initial={'spectacles': participant.choicesrevente.all()})
|
||||||
|
|
||||||
return render(request, "liste-reventes.html",
|
return render(request, "liste-reventes.html",
|
||||||
{"form": form, 'shotgun': shotgun,
|
{"form": form,
|
||||||
"deja_revente": deja_revente, "success": success})
|
"deja_revente": deja_revente, "success": success})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue