Merge branch 'Aufinal/fix_revente_reinit' into 'master'

Aufinal/fix revente reinit

Fixe le cas où answered_mail est vide

See merge request !93
This commit is contained in:
Martin Pepin 2016-10-06 15:25:20 +02:00
commit e267cb91ef
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\ self.fields['attributions'].queryset = participant.attribution_set\
.filter(spectacle__date__gte=timezone.now(), .filter(spectacle__date__gte=timezone.now(),
revente__isnull=False, 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) | .filter(Q(revente__soldTo__isnull=True) |
Q(revente__soldTo=participant)) Q(revente__soldTo=participant))

View file

@ -228,6 +228,7 @@ class SpectacleRevente(models.Model):
answered_mail = models.ManyToManyField(Participant, answered_mail = models.ManyToManyField(Participant,
related_name="wanted", related_name="wanted",
blank=True) blank=True)
seller = models.ForeignKey(Participant, seller = models.ForeignKey(Participant,
related_name="original_shows", related_name="original_shows",
verbose_name="Vendeur") verbose_name="Vendeur")

View file

@ -333,7 +333,9 @@ def revente(request, tirage_id):
revente = rev.get() revente = rev.get()
revente.date = timezone.now() - timedelta(hours=1) revente.date = timezone.now() - timedelta(hours=1)
revente.soldTo = None revente.soldTo = None
revente.answered_mail = None if revente.answered_mail:
revente.answered_mail.clear()
revente.save()
else: else:
resellform = ResellForm(participant, prefix='resell') resellform = ResellForm(participant, prefix='resell')