From 7ec6d2398763e3b6eaff32ff069e1daa6abccc2c Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Thu, 6 Oct 2016 14:26:47 +0200 Subject: [PATCH] fix reinit --- bda/forms.py | 2 +- bda/models.py | 1 + bda/views.py | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bda/forms.py b/bda/forms.py index c2eec894..fe20e565 100644 --- a/bda/forms.py +++ b/bda/forms.py @@ -68,7 +68,7 @@ class AnnulForm(forms.Form): self.fields['attributions'].queryset = participant.attribution_set\ .filter(spectacle__date__gte=timezone.now(), revente__isnull=False, - revente__date__gte=timezone.now()-timedelta(hours=1))\ + revente__date__gt=timezone.now()-timedelta(hours=1))\ .filter(Q(revente__soldTo__isnull=True) | Q(revente__soldTo=participant)) diff --git a/bda/models.py b/bda/models.py index d1b5ba3c..a10fe5b4 100644 --- a/bda/models.py +++ b/bda/models.py @@ -223,6 +223,7 @@ class SpectacleRevente(models.Model): answered_mail = models.ManyToManyField(Participant, related_name="wanted", blank=True) + seller = models.ForeignKey(Participant, related_name="original_shows", verbose_name="Vendeur") diff --git a/bda/views.py b/bda/views.py index 4f1ba977..b87b90d4 100644 --- a/bda/views.py +++ b/bda/views.py @@ -333,7 +333,9 @@ def revente(request, tirage_id): revente = rev.get() revente.date = timezone.now() - timedelta(hours=1) revente.soldTo = None - revente.answered_mail = None + if revente.answered_mail: + revente.answered_mail.clear() + revente.save() else: resellform = ResellForm(participant, prefix='resell')