Fix #860 -- Compatibility with SQLite 3.23.0

This commit is contained in:
Raphael Michel
2018-04-10 12:21:39 +02:00
parent 00ee58d3fd
commit 34a04c0059

View File

@@ -1068,9 +1068,10 @@ class Quota(LoggedModel):
return CartPosition.objects.filter( return CartPosition.objects.filter(
Q(event=self.event) & Q(subevent=self.subevent) & Q(event=self.event) & Q(subevent=self.subevent) &
Q(expires__gte=now_dt) & Q(expires__gte=now_dt) &
~Q( Q(
Q(voucher__isnull=False) & Q(voucher__block_quota=True) Q(voucher__isnull=True)
& Q(Q(voucher__valid_until__isnull=True) | Q(voucher__valid_until__gte=now_dt)) | Q(voucher__block_quota=False)
| Q(voucher__valid_until__lt=now_dt)
) & ) &
self._position_lookup self._position_lookup
).count() ).count()