forked from DGNum/gestioCOF
fix bug shotgun
This commit is contained in:
parent
15e755334d
commit
59b8f406b6
1 changed files with 7 additions and 3 deletions
10
bda/views.py
10
bda/views.py
|
@ -406,7 +406,7 @@ def list_revente(request, tirage_id):
|
|||
if qset.exists():
|
||||
# On l'inscrit à l'un des tirages au sort
|
||||
for revente in qset.all():
|
||||
if revente.shotgun:
|
||||
if revente.shotgun and not revente.soldTo:
|
||||
deja_revente = True
|
||||
else:
|
||||
revente.interested.add(participant)
|
||||
|
@ -435,12 +435,16 @@ 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)
|
||||
|
||||
if not reventes.exists():
|
||||
if reventes_shotgun.empty():
|
||||
return render(request, "bda-no-revente.html", {})
|
||||
|
||||
if request.POST:
|
||||
revente = random.choice(reventes.all())
|
||||
revente = random.choice(reventes_shotgun)
|
||||
revente.soldTo = participant
|
||||
revente.save()
|
||||
mail = """Bonjour !
|
||||
|
|
Loading…
Reference in a new issue