forked from DGNum/gestioCOF
change shotgun en booleanfield
This commit is contained in:
parent
e267cb91ef
commit
4c6b33ccb4
3 changed files with 12 additions and 25 deletions
20
bda/views.py
20
bda/views.py
|
@ -367,6 +367,7 @@ def revente_interested(request, revente_id):
|
|||
participant, created = Participant.objects.get_or_create(
|
||||
user=request.user, tirage=revente.attribution.spectacle.tirage)
|
||||
if timezone.now() < revente.date + timedelta(hours=1) or revente.shotgun:
|
||||
# TODO améliorer le message d'erreur
|
||||
return render(request, "bda-wrongtime.html", {})
|
||||
|
||||
revente.answered_mail.add(participant)
|
||||
|
@ -388,13 +389,9 @@ def list_revente(request, tirage_id):
|
|||
for spectacle in spectacles:
|
||||
revente_objects = SpectacleRevente.objects.filter(
|
||||
attribution__spectacle=spectacle,
|
||||
soldTo__isnull=True)
|
||||
revente_count = 0
|
||||
for revente in revente_objects:
|
||||
if revente.shotgun:
|
||||
revente_count += 1
|
||||
if revente_count:
|
||||
spectacle.revente_count = revente_count
|
||||
soldTo__isnull=True,
|
||||
shotgun=True)
|
||||
if revente_objects.exists():
|
||||
shotgun.append(spectacle)
|
||||
|
||||
if request.method == 'POST':
|
||||
|
@ -440,16 +437,13 @@ def buy_revente(request, spectacle_id):
|
|||
revente.delete()
|
||||
return HttpResponseRedirect(reverse("bda-liste-revente",
|
||||
args=[tirage.id]))
|
||||
reventes_shotgun = []
|
||||
for revente in reventes.all():
|
||||
if revente.shotgun:
|
||||
reventes_shotgun.append(revente)
|
||||
reventes_shotgun = reventes.filter(shotgun=True)
|
||||
|
||||
if not reventes_shotgun:
|
||||
if not reventes_shotgun.exists():
|
||||
return render(request, "bda-no-revente.html", {})
|
||||
|
||||
if request.POST:
|
||||
revente = random.choice(reventes_shotgun)
|
||||
revente = random.choice(reventes_shotgun.all())
|
||||
revente.soldTo = participant
|
||||
revente.save()
|
||||
mail = """Bonjour !
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue