diff --git a/src/pretix/helpers/templatetags/jsonfield.py b/src/pretix/helpers/templatetags/jsonfield.py index bb04757ab..23ba60fe4 100644 --- a/src/pretix/helpers/templatetags/jsonfield.py +++ b/src/pretix/helpers/templatetags/jsonfield.py @@ -5,17 +5,6 @@ from django.db import NotSupportedError from django.db.models import Expression, JSONField -def mysql_compile_json_path(key_transforms): - path = ['$'] - for key_transform in key_transforms: - try: - num = int(key_transform) - path.append('[{}]'.format(num)) - except ValueError: # non-integer - path.append('.') - path.append(key_transform) - return ''.join(path) - def postgres_compile_json_path(key_transforms): return "{" + ','.join(key_transforms) + "}" @@ -41,17 +30,9 @@ def as_sql(self, compiler, connection, function=None, template=None, arg_joiner= params.append(json_path) template = '{} #> %s'.format(arg_sql) return template, params - elif '.mysql' in connection.settings_dict['ENGINE']: - params = [] - arg_sql, arg_params = compiler.compile(self.source_expression) - params.extend(arg_params) - json_path = mysql_compile_json_path(self.path) - params.append(json_path) - template = 'JSON_EXTRACT({}, %s)'.format(arg_sql) - return template, params else: raise NotSupportedError( - 'Functions on JSONFields are only supported on PostgreSQL and MySQL at the moment.' + 'Functions on JSONFields are only supported on PostgreSQL.' ) def copy(self): diff --git a/src/setup.py b/src/setup.py index 074102ed2..579ff0ae4 100644 --- a/src/setup.py +++ b/src/setup.py @@ -108,7 +108,7 @@ def run(self): 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', - 'Framework :: Django :: 3.0' + 'Framework :: Django :: 3.2' ], keywords='tickets web shop ecommerce', @@ -125,8 +125,9 @@ def run(self): 'django-hierarkey==1.0.*,>=1.0.4', 'django-filter==2.4.*', 'django-scopes==1.2.*', + 'django-localflavor==3.0.*', 'reportlab>=3.5.65', - 'Pillow=8.*', + 'Pillow==8.*', 'PyPDF2==1.26.*', 'django-libsass==0.8', 'libsass==0.20.*', @@ -158,7 +159,6 @@ def run(self): 'mt-940==3.2', 'django-i18nfield==1.9.*,>=1.9.1', 'psycopg2-binary', - 'django-mysql', 'tqdm==4.*', 'vobject==0.9.*', 'pycountry', diff --git a/src/tests/api/test_items.py b/src/tests/api/test_items.py index 6851444f0..f8fac49fe 100644 --- a/src/tests/api/test_items.py +++ b/src/tests/api/test_items.py @@ -718,10 +718,7 @@ def test_item_create_with_addon(token_client, organizer, event, item, category, format='json' ) assert resp.status_code == 400 - assert resp.content.decode() in [ - '{"addons":["The minimum count needs to be equal to or greater than zero."]}', - '{"addons":[{"min_count":["Ensure this value is greater than or equal to 0."]}]}', # mysql - ] + assert resp.content.decode() == '{"addons":["The minimum count needs to be equal to or greater than zero."]}' with scopes_disabled(): assert 2 == Item.objects.all().count()