fix reinit

This commit is contained in:
Ludovic Stephan 2016-10-06 14:26:47 +02:00
parent 5e848e4442
commit 7ec6d23987
3 changed files with 5 additions and 2 deletions

View file

@ -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))

View file

@ -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")

View file

@ -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')