Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed to Django 4.2 version #63

Closed
wants to merge 12 commits into from
Closed
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates


version: 2

updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
versioning-strategy: increase
- package-ecosystem: "npm"
directory: "/src/pretix/static/npm_dir"
schedule:
interval: "daily"
10 changes: 3 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@ jobs:
name: Tests
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.8]
database: [sqlite, postgres, mysql]
exclude:
- database: mysql
python-version: 3.7
python-version: 3.8
- database: sqlite
python-version: 3.7
- database: mysql
python-version: 3.6
- database: sqlite
python-version: 3.6
python-version: 3.8
steps:
- uses: actions/checkout@v2
- uses: getong/[email protected]
Expand Down
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM python:3.8
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
default-libmysqlclient-dev \
gettext \
git \
libffi-dev \
Expand Down Expand Up @@ -51,7 +50,6 @@ RUN pip3 install -U \
pip3 install \
-r requirements.txt \
-r requirements/memcached.txt \
-r requirements/mysql.txt \
gunicorn django-extensions ipython && \
rm -rf ~/.cache/pip

Expand Down
7 changes: 6 additions & 1 deletion deployment/docker/production_settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from pretix.settings import *

LOGGING['handlers']['mail_admins']['include_html'] = True
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
STORAGES = {
**STORAGES,
"staticfiles": {
"BACKEND": 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage',
},
}
11 changes: 2 additions & 9 deletions doc/admin/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,30 +135,23 @@ Database settings
Example::

[database]
backend=mysql
backend=postgresql
name=pretix
user=pretix
password=abcd
host=localhost
port=3306

``backend``
One of ``mysql``, ``sqlite3``, ``oracle`` and ``postgresql``.
One of ``sqlite3``, ``oracle`` and ``postgresql``.
Default: ``sqlite3``.

If you use MySQL, be sure to create your database using
``CREATE DATABASE <dbname> CHARACTER SET utf8;``. Otherwise, Unicode
support will not properly work.

``name``
The database's name. Default: ``db.sqlite3``.

``user``, ``password``, ``host``, ``port``
Connection details for the database connection. Empty by default.

``galera``
Indicates if the database backend is a MySQL/MariaDB Galera cluster and
turns on some optimizations/special case handlers. Default: ``False``

.. _`config-replica`:

Expand Down
4 changes: 3 additions & 1 deletion doc/development/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ Your should install the following on your system:
* ``libssl`` (Debian package: ``libssl-dev``)
* ``libxml2`` (Debian package ``libxml2-dev``)
* ``libxslt`` (Debian package ``libxslt1-dev``)
* ``libenchant1c2a`` (Debian package ``libenchant1c2a``)
* ``libenchant1c2a`` (Debian package ``libenchant1c2a`` or ``libenchant2-2``)
* ``msgfmt`` (Debian package ``gettext``)
* ``freetype`` (Debian package ``libfreetype-dev``)
* ``git``
* for pillow: ``libjpeg`` (Debian Package ``libjpeg-dev``)

Your local python environment
-----------------------------
Expand Down
1 change: 0 additions & 1 deletion src/pretix/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ def ready(self):
from . import signals, webhooks # noqa


default_app_config = 'pretix.api.PretixApiConfig'
2 changes: 1 addition & 1 deletion src/pretix/api/auth/devicesecurity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class FullAccessSecurityProfile:
Expand Down
2 changes: 1 addition & 1 deletion src/pretix/api/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __call__(self, request: HttpRequest):
call.response_body = json.dumps(resp.data)
else:
call.response_body = repr(resp).encode()
call.response_headers = json.dumps(resp._headers)
call.response_headers = json.dumps(resp.headers._store)
call.locked = None
call.save(update_fields=['locked', 'response_code', 'response_headers',
'response_body'])
Expand Down
4 changes: 1 addition & 3 deletions src/pretix/api/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
from pretix.base.signals import periodic_task
from pretix.helpers.periodic import minimum_interval

register_webhook_events = Signal(
providing_args=[]
)
register_webhook_events = Signal()
"""
This signal is sent out to get all known webhook events. Receivers should return an
instance of a subclass of pretix.api.webhooks.WebhookEvent or a list of such
Expand Down
46 changes: 23 additions & 23 deletions src/pretix/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import importlib

from django.apps import apps
from django.conf.urls import include, url
from django.urls import include, path
from rest_framework import routers

from pretix.api.views import cart
Expand Down Expand Up @@ -72,30 +72,30 @@
importlib.import_module(app.name + '.urls')

urlpatterns = [
url(r'^', include(router.urls)),
url(r'^organizers/(?P<organizer>[^/]+)/', include(orga_router.urls)),
url(r'^organizers/(?P<organizer>[^/]+)/settings/$', organizer.OrganizerSettingsView.as_view(),
path('', include(router.urls)),
path('organizers/<str:organizer>/', include(orga_router.urls)),
path('organizers/<str:organizer>/settings/', organizer.OrganizerSettingsView.as_view(),
name="organizer.settings"),
url(r'^organizers/(?P<organizer>[^/]+)/giftcards/(?P<giftcard>[^/]+)/', include(giftcard_router.urls)),
url(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/settings/$', event.EventSettingsView.as_view(),
path('organizers/<str:organizer>/giftcards/<str:giftcard>/', include(giftcard_router.urls)),
path('organizers/<str:organizer>/events/<str:event>/settings/', event.EventSettingsView.as_view(),
name="event.settings"),
url(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/', include(event_router.urls)),
url(r'^organizers/(?P<organizer>[^/]+)/teams/(?P<team>[^/]+)/', include(team_router.urls)),
url(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/items/(?P<item>[^/]+)/', include(item_router.urls)),
url(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/questions/(?P<question>[^/]+)/',
path('organizers/<str:organizer>/events/<str:event>/', include(event_router.urls)),
path('organizers/<str:organizer>/teams/<str:team>/', include(team_router.urls)),
path('organizers/<str:organizer>/events/<str:event>/items/<str:item>/', include(item_router.urls)),
path('organizers/<str:organizer>/events/<str:event>/questions/<str:question>/',
include(question_router.urls)),
url(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/checkinlists/(?P<list>[^/]+)/',
path('organizers/<str:organizer>/events/<str:event>/checkinlists/<str:list>/',
include(checkinlist_router.urls)),
url(r'^organizers/(?P<organizer>[^/]+)/events/(?P<event>[^/]+)/orders/(?P<order>[^/]+)/', include(order_router.urls)),
url(r"^oauth/authorize$", oauth.AuthorizationView.as_view(), name="authorize"),
url(r"^oauth/token$", oauth.TokenView.as_view(), name="token"),
url(r"^oauth/revoke_token$", oauth.RevokeTokenView.as_view(), name="revoke-token"),
url(r"^device/initialize$", device.InitializeView.as_view(), name="device.initialize"),
url(r"^device/update$", device.UpdateView.as_view(), name="device.update"),
url(r"^device/roll$", device.RollKeyView.as_view(), name="device.roll"),
url(r"^device/revoke$", device.RevokeKeyView.as_view(), name="device.revoke"),
url(r"^device/eventselection$", device.EventSelectionView.as_view(), name="device.eventselection"),
url(r"^upload$", upload.UploadView.as_view(), name="upload"),
url(r"^me$", user.MeView.as_view(), name="user.me"),
url(r"^version$", version.VersionView.as_view(), name="version"),
path('organizers/<str:organizer>/events/<str:event>/orders/<str:order>/', include(order_router.urls)),
path("oauth/authorize", oauth.AuthorizationView.as_view(), name="authorize"),
path("oauth/token", oauth.TokenView.as_view(), name="token"),
path("oauth/revoke_token", oauth.RevokeTokenView.as_view(), name="revoke-token"),
path("device/initialize", device.InitializeView.as_view(), name="device.initialize"),
path("device/update", device.UpdateView.as_view(), name="device.update"),
path("device/roll", device.RollKeyView.as_view(), name="device.roll"),
path("device/revoke", device.RevokeKeyView.as_view(), name="device.revoke"),
path("device/eventselection", device.EventSelectionView.as_view(), name="device.eventselection"),
path("upload", upload.UploadView.as_view(), name="upload"),
path("me", user.MeView.as_view(), name="user.me"),
path("version", version.VersionView.as_view(), name="version"),
]
1 change: 0 additions & 1 deletion src/pretix/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def ready(self):
initialize()


default_app_config = 'pretix.base.PretixBaseConfig'
try:
import pretix.celery_app as celery # NOQA
except ImportError:
Expand Down
9 changes: 5 additions & 4 deletions src/pretix/base/i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ def __str__(self):
def get_babel_locale():
babel_locale = 'en'
# Babel, and therefore django-phonenumberfield, do not support our custom locales such das de_Informal
if localedata.exists(translation.get_language()):
babel_locale = translation.get_language()
elif localedata.exists(translation.get_language()[:2]):
babel_locale = translation.get_language()[:2]
if translation.get_language():
if localedata.exists(translation.get_language()):
babel_locale = translation.get_language()
elif localedata.exists(translation.get_language()[:2]):
babel_locale = translation.get_language()[:2]
return babel_locale


Expand Down
9 changes: 4 additions & 5 deletions src/pretix/base/migrations/0102_auto_20181017_0024.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Generated by Django 2.1 on 2018-10-17 00:24

import jsonfallback.fields
from django.core.exceptions import ImproperlyConfigured
from django.db import migrations
from django.db import migrations, models
from django_mysql.checks import mysql_connections
from django_mysql.utils import connection_is_mariadb

Expand Down Expand Up @@ -77,19 +76,19 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='cartposition',
name='attendee_name_parts',
field=jsonfallback.fields.FallbackJSONField(null=False, default=dict),
field=models.JSONField(null=False, default=dict),
preserve_default=False,
),
migrations.AddField(
model_name='orderposition',
name='attendee_name_parts',
field=jsonfallback.fields.FallbackJSONField(null=False, default=dict),
field=models.JSONField(null=False, default=dict),
preserve_default=False,
),
migrations.AddField(
model_name='invoiceaddress',
name='name_parts',
field=jsonfallback.fields.FallbackJSONField(default=dict),
field=models.JSONField(default=dict),
preserve_default=False,
),
migrations.RunPython(set_attendee_name_parts, migrations.RunPython.noop)
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0103_auto_20181121_1224.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1.1 on 2018-11-21 12:24

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0104_auto_20181114_1526.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import django.db.models.deletion
import django.db.models.manager
import jsonfallback.fields
from django.db import migrations, models


Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0105_auto_20190112_1512.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1 on 2019-01-12 15:12

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0107_auto_20190129_1337.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1.5 on 2019-01-29 13:37

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0108_auto_20190201_1527.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1.5 on 2019-02-01 15:27

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from decimal import Decimal

import django.db.models.deletion
import jsonfallback.fields
from django.conf import settings
from django.core.cache import cache
from django.db import migrations, models
Expand Down Expand Up @@ -190,7 +189,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='cartposition',
name='attendee_name_parts',
field=jsonfallback.fields.FallbackJSONField(default=dict),
field=models.JSONField(default=dict),
),
migrations.AlterField(
model_name='cartposition',
Expand All @@ -210,7 +209,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='invoiceaddress',
name='name_parts',
field=jsonfallback.fields.FallbackJSONField(default=dict),
field=models.JSONField(default=dict),
),
migrations.AlterField(
model_name='item',
Expand All @@ -225,7 +224,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='orderposition',
name='attendee_name_parts',
field=jsonfallback.fields.FallbackJSONField(default=dict),
field=models.JSONField(default=dict),
),
migrations.AlterField(
model_name='orderposition',
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0109_auto_20190208_1432.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1 on 2019-02-08 14:32

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0110_auto_20190219_1245.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1.5 on 2019-02-19 12:45

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0111_auto_20190219_0949.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1.5 on 2019-02-19 09:49

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0113_auto_20190312_0942.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1.5 on 2019-03-12 09:42

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0114_auto_20190316_1014.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1.7 on 2019-03-16 10:14

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0115_auto_20190323_2238.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from decimal import Decimal

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
1 change: 0 additions & 1 deletion src/pretix/base/migrations/0116_auto_20190402_0722.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Generated by Django 2.1.5 on 2019-04-02 07:22

import django.db.models.deletion
import jsonfallback.fields
from django.db import migrations, models

import pretix.base.models.fields
Expand Down
Loading