diff --git a/src/pretix/plugins/wallet/styles.py b/src/pretix/plugins/wallet/styles.py index e2cc6b233..42a1146d9 100644 --- a/src/pretix/plugins/wallet/styles.py +++ b/src/pretix/plugins/wallet/styles.py @@ -4,7 +4,23 @@ import enum from django.utils.translation import gettext_lazy as _ from django.core.exceptions import ValidationError from i18nfield.strings import LazyI18nString +from .models import WalletLayout +class WalletPlatform: + identifier: str + name: str + + def get_layout_qs(self): + return WalletLayout.objects.filter(platform=self.identifier) + +class ApplePlatform(WalletPlatform): + identifier = "apple" + name = _("Apple") + +class GooglePlatform(WalletPlatform): + identifier = "apple" + name = _("Google") + class PlaceholderFieldType(enum.Enum): TEXT = "text" CODE = "qr" @@ -108,6 +124,7 @@ class GoogleWalletEventTicket(PassStyle): ] +AVAILABLE_PLATFORMS = {"apple": ApplePlatform, "google": GooglePlatform} AVAILABLE_STYLES = [AppleWalletEventTicket(), GoogleWalletEventTicket()] def get_platforms_with_styles(): @@ -127,7 +144,7 @@ def get_platform_styles(platform): return platform_styles def get_platforms(): - return sorted(set(style.platform for style in AVAILABLE_STYLES)) + return AVAILABLE_PLATFORMS class PassLayout: style: PassStyle diff --git a/src/pretix/plugins/wallet/templates/pretixplugins/wallet/edit.html b/src/pretix/plugins/wallet/templates/pretixplugins/wallet/edit.html index 955ce9cc1..4bd6c08e4 100644 --- a/src/pretix/plugins/wallet/templates/pretixplugins/wallet/edit.html +++ b/src/pretix/plugins/wallet/templates/pretixplugins/wallet/edit.html @@ -1,6 +1,8 @@ {% extends "pretixcontrol/event/base.html" %} {% load i18n %} {% load money %} +{% load bootstrap3 %} + {% block title %}{% trans "Wallet layouts" %}{% endblock %} {% block content %}
{{ styles }}
@@ -9,7 +11,7 @@
{{ variables|json_script:"variables" }}