forked from DGNum/gestioCOF
Merge branch 'Aufinal/fix_reinit_past' into 'master'
Aufinal/fix reinit past Rajoute quelques vérifications de date lors d'une réinitialisation See merge request !110
This commit is contained in:
commit
b60365ddd6
2 changed files with 10 additions and 8 deletions
|
@ -257,7 +257,8 @@ class SpectacleReventeAdmin(admin.ModelAdmin):
|
|||
Réinitialise les reventes.
|
||||
"""
|
||||
count = queryset.count()
|
||||
for revente in queryset.all():
|
||||
for revente in queryset.filter(
|
||||
attribution__spectacle__date__gte=timezone.now()):
|
||||
revente.date = timezone.now() - timedelta(hours=1)
|
||||
revente.soldTo = None
|
||||
revente.notif_sent = False
|
||||
|
|
15
bda/views.py
15
bda/views.py
|
@ -329,13 +329,14 @@ def revente(request, tirage_id):
|
|||
id=revente_id)
|
||||
if rev.exists():
|
||||
revente = rev.get()
|
||||
revente.date = timezone.now() - timedelta(hours=1)
|
||||
revente.soldTo = None
|
||||
revente.notif_sent = False
|
||||
revente.tirage_done = False
|
||||
if revente.answered_mail:
|
||||
revente.answered_mail.clear()
|
||||
revente.save()
|
||||
if revente.attribution.spectacle.date > timezone.now():
|
||||
revente.date = timezone.now() - timedelta(hours=1)
|
||||
revente.soldTo = None
|
||||
revente.notif_sent = False
|
||||
revente.tirage_done = False
|
||||
if revente.answered_mail:
|
||||
revente.answered_mail.clear()
|
||||
revente.save()
|
||||
|
||||
else:
|
||||
resellform = ResellForm(participant, prefix='resell')
|
||||
|
|
Loading…
Reference in a new issue