better annulation check

This commit is contained in:
Ludovic Stephan 2017-02-16 02:28:57 -02:00
parent d9402e1059
commit d524d9286f
2 changed files with 3 additions and 4 deletions

View file

@ -4,8 +4,6 @@ from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from datetime import timedelta
from django import forms
from django.forms.models import BaseInlineFormSet
from django.utils import timezone
@ -69,7 +67,7 @@ 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),
revente__notif_sent=False,
revente__soldTo__isnull=True)

View file

@ -396,7 +396,8 @@ def revente(request, tirage_id):
spectacle__date__gte=timezone.now(),
revente__isnull=False,
revente__seller=participant,
revente__date__lte=timezone.now()-timedelta(hours=1)).filter(
revente__notif_sent=True)\
.filter(
Q(revente__soldTo__isnull=True) | Q(revente__soldTo=participant))
return render(request, "bda-revente.html",