change soldTo functioning

This commit is contained in:
Ludovic Stephan 2016-12-21 00:45:30 -02:00
parent 38dd220c23
commit 9bbc9e934d
2 changed files with 5 additions and 5 deletions

View file

@ -68,9 +68,8 @@ class AnnulForm(forms.Form):
self.fields['attributions'].queryset = participant.attribution_set\
.filter(spectacle__date__gte=timezone.now(),
revente__isnull=False,
revente__date__gt=timezone.now()-timedelta(hours=1))\
.filter(Q(revente__soldTo__isnull=True) |
Q(revente__soldTo=participant))
revente__date__gt=timezone.now()-timedelta(hours=1),
revente__soldTo__isnull=True)
class InscriptionReventeForm(forms.Form):

View file

@ -285,6 +285,7 @@ def revente(request, tirage_id):
if not created:
revente.seller = participant
revente.date = timezone.now()
revente.soldTo = None
revente.notif_sent = False
revente.tirage_done = False
revente.shotgun = False
@ -337,6 +338,7 @@ def revente(request, tirage_id):
revente.soldTo = None
revente.notif_sent = False
revente.tirage_done = False
revente.shotgun = False
if revente.answered_mail:
revente.answered_mail.clear()
revente.save()
@ -357,8 +359,7 @@ def revente(request, tirage_id):
sold = participant.attribution_set.filter(
spectacle__date__gte=timezone.now(),
revente__isnull=False,
revente__soldTo__isnull=False).exclude(
revente__soldTo=participant)
revente__soldTo__isnull=False)
return render(request, "bda-revente.html",
{'tirage': tirage, 'overdue': overdue, "sold": sold,