Fix tests.api

This commit is contained in:
Raphael Michel
2019-06-17 10:04:54 +02:00
parent 5c06c41a5b
commit 867667cd12
29 changed files with 871 additions and 574 deletions
+1 -1
View File
@@ -2,7 +2,6 @@ import string
import uuid
from collections import OrderedDict
from datetime import datetime, time, timedelta
from django_scopes import ScopedManager
from operator import attrgetter
import pytz
@@ -18,6 +17,7 @@ from django.utils.crypto import get_random_string
from django.utils.functional import cached_property
from django.utils.timezone import make_aware, now
from django.utils.translation import ugettext_lazy as _
from django_scopes import ScopedManager
from i18nfield.fields import I18nCharField, I18nTextField
from pretix.base.models.base import LoggedModel
+5 -6
View File
@@ -3,7 +3,6 @@ import uuid
from collections import Counter
from datetime import date, datetime, time
from decimal import Decimal, DecimalException
from django_scopes import ScopedManager
from typing import Tuple
import dateutil.parser
@@ -18,6 +17,7 @@ from django.utils.functional import cached_property
from django.utils.timezone import is_naive, make_aware, now
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
from django_countries.fields import Country
from django_scopes import ScopedManager
from i18nfield.fields import I18nCharField, I18nTextField
from pretix.base.models import fields
@@ -160,10 +160,10 @@ def filter_available(qs, channel='web', voucher=None, allow_addons=False):
q = (
# IMPORTANT: If this is updated, also update the ItemVariation query
# in models/event.py: EventMixin.annotated()
Q(active=True)
& Q(Q(available_from__isnull=True) | Q(available_from__lte=now()))
& Q(Q(available_until__isnull=True) | Q(available_until__gte=now()))
& Q(sales_channels__contains=channel) & Q(require_bundling=False)
Q(active=True)
& Q(Q(available_from__isnull=True) | Q(available_from__lte=now()))
& Q(Q(available_until__isnull=True) | Q(available_until__gte=now()))
& Q(sales_channels__contains=channel) & Q(require_bundling=False)
)
if not allow_addons:
q &= Q(Q(category__isnull=True) | Q(category__is_addon=False))
@@ -391,7 +391,6 @@ class Item(LoggedModel):
# !!! Attention: If you add new fields here, also add them to the copying code in
# pretix/control/forms/item.py if applicable.
class Meta:
verbose_name = _("Product")
verbose_name_plural = _("Products")
+1 -1
View File
@@ -6,7 +6,6 @@ import os
import string
from datetime import datetime, time, timedelta
from decimal import Decimal
from django_scopes import ScopedManager
from typing import Any, Dict, List, Union
import dateutil
@@ -27,6 +26,7 @@ from django.utils.functional import cached_property
from django.utils.timezone import make_aware, now
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
from django_countries.fields import Country, CountryField
from django_scopes import ScopedManager
from i18nfield.strings import LazyI18nString
from jsonfallback.fields import FallbackJSONField