mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Upgrade to Django 3.2 (#2056)
This commit is contained in:
@@ -19,32 +19,3 @@
|
||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
from django.apps import AppConfig
|
||||
from django.utils.translation import gettext, gettext_lazy as _
|
||||
|
||||
from pretix import __version__ as version
|
||||
|
||||
|
||||
class BadgesApp(AppConfig):
|
||||
name = 'pretix.plugins.badges'
|
||||
verbose_name = _("Badges")
|
||||
|
||||
class PretixPluginMeta:
|
||||
name = _("Badges")
|
||||
author = _("the pretix team")
|
||||
version = version
|
||||
category = "FEATURE"
|
||||
description = _("This plugin allows you to generate badges or name tags for your attendees.")
|
||||
|
||||
def ready(self):
|
||||
from . import signals # NOQA
|
||||
|
||||
def installed(self, event):
|
||||
if not event.badge_layouts.exists():
|
||||
event.badge_layouts.create(
|
||||
name=gettext('Default'),
|
||||
default=True,
|
||||
)
|
||||
|
||||
|
||||
default_app_config = 'pretix.plugins.badges.BadgesApp'
|
||||
|
||||
47
src/pretix/plugins/badges/apps.py
Normal file
47
src/pretix/plugins/badges/apps.py
Normal file
@@ -0,0 +1,47 @@
|
||||
#
|
||||
# This file is part of pretix (Community Edition).
|
||||
#
|
||||
# Copyright (C) 2014-2020 Raphael Michel and contributors
|
||||
# Copyright (C) 2020-2021 rami.io GmbH and contributors
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
|
||||
# Public License as published by the Free Software Foundation in version 3 of the License.
|
||||
#
|
||||
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
|
||||
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
|
||||
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
|
||||
# this file, see <https://pretix.eu/about/en/license>.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
|
||||
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
from django.apps import AppConfig
|
||||
from django.utils.translation import gettext, gettext_lazy as _
|
||||
|
||||
from pretix import __version__ as version
|
||||
|
||||
|
||||
class BadgesApp(AppConfig):
|
||||
name = 'pretix.plugins.badges'
|
||||
verbose_name = _("Badges")
|
||||
|
||||
class PretixPluginMeta:
|
||||
name = _("Badges")
|
||||
author = _("the pretix team")
|
||||
version = version
|
||||
category = "FEATURE"
|
||||
description = _("This plugin allows you to generate badges or name tags for your attendees.")
|
||||
|
||||
def ready(self):
|
||||
from . import signals # NOQA
|
||||
|
||||
def installed(self, event):
|
||||
if not event.badge_layouts.exists():
|
||||
event.badge_layouts.create(
|
||||
name=gettext('Default'),
|
||||
default=True,
|
||||
)
|
||||
@@ -41,7 +41,6 @@ from typing import Tuple
|
||||
|
||||
import dateutil.parser
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.contrib.staticfiles import finders
|
||||
from django.core.files import File
|
||||
from django.core.files.storage import default_storage
|
||||
@@ -49,7 +48,6 @@ from django.db.models import Exists, OuterRef, Q
|
||||
from django.db.models.functions import Coalesce
|
||||
from django.utils.timezone import make_aware
|
||||
from django.utils.translation import gettext as _, gettext_lazy
|
||||
from jsonfallback.functions import JSONExtract
|
||||
from reportlab.lib import pagesizes
|
||||
from reportlab.lib.units import mm
|
||||
from reportlab.pdfgen import canvas
|
||||
@@ -60,6 +58,7 @@ from pretix.base.models import Order, OrderPosition
|
||||
from pretix.base.pdf import Renderer
|
||||
from pretix.base.services.orders import OrderError
|
||||
from pretix.base.settings import PERSON_NAME_SCHEMES
|
||||
from pretix.helpers.templatetags.jsonfield import JSONExtract
|
||||
from pretix.plugins.badges.models import BadgeItem, BadgeLayout
|
||||
|
||||
|
||||
@@ -297,7 +296,7 @@ class BadgeExporter(BaseExporter):
|
||||
] + ([
|
||||
('name:{}'.format(k), _('Attendee name: {part}').format(part=label))
|
||||
for k, label, w in name_scheme['fields']
|
||||
] if settings.JSON_FIELD_AVAILABLE and len(name_scheme['fields']) > 1 else []),
|
||||
] if len(name_scheme['fields']) > 1 else []),
|
||||
)),
|
||||
]
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
|
||||
# <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
from django.conf.urls import url
|
||||
from django.conf.urls import re_path
|
||||
|
||||
from pretix.api.urls import event_router
|
||||
from pretix.plugins.badges.api import BadgeItemViewSet, BadgeLayoutViewSet
|
||||
@@ -30,18 +30,18 @@ from .views import (
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/$',
|
||||
LayoutListView.as_view(), name='index'),
|
||||
url(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/print$',
|
||||
OrderPrintDo.as_view(), name='print'),
|
||||
url(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/add$',
|
||||
LayoutCreate.as_view(), name='add'),
|
||||
url(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/(?P<layout>\d+)/default$',
|
||||
LayoutSetDefault.as_view(), name='default'),
|
||||
url(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/(?P<layout>\d+)/delete$',
|
||||
LayoutDelete.as_view(), name='delete'),
|
||||
url(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/(?P<layout>\d+)/editor',
|
||||
LayoutEditorView.as_view(), name='edit'),
|
||||
re_path(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/$',
|
||||
LayoutListView.as_view(), name='index'),
|
||||
re_path(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/print$',
|
||||
OrderPrintDo.as_view(), name='print'),
|
||||
re_path(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/add$',
|
||||
LayoutCreate.as_view(), name='add'),
|
||||
re_path(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/(?P<layout>\d+)/default$',
|
||||
LayoutSetDefault.as_view(), name='default'),
|
||||
re_path(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/(?P<layout>\d+)/delete$',
|
||||
LayoutDelete.as_view(), name='delete'),
|
||||
re_path(r'^control/event/(?P<organizer>[^/]+)/(?P<event>[^/]+)/badges/(?P<layout>\d+)/editor',
|
||||
LayoutEditorView.as_view(), name='edit'),
|
||||
]
|
||||
event_router.register('badgelayouts', BadgeLayoutViewSet)
|
||||
event_router.register('badgeitems', BadgeItemViewSet)
|
||||
|
||||
Reference in New Issue
Block a user