diff --git a/src/pretix/control/forms/global_settings.py b/src/pretix/control/forms/global_settings.py index 73c26431b5..7cff27101c 100644 --- a/src/pretix/control/forms/global_settings.py +++ b/src/pretix/control/forms/global_settings.py @@ -281,6 +281,62 @@ def __init__(self, *args, **kwargs): ] ) + self.field_groups = [ + (_('Basics'), [ + 'footer_text', + 'footer_link', + 'banner_message', + 'banner_message_detail', + ]), + (_('Localization'), [ + 'region', + ]), + (_('Email'), [ + 'mail_from', + 'email_vendor', + 'send_grid_api_key', + 'smtp_host', + 'smtp_port', + 'smtp_username', + 'smtp_password', + 'smtp_use_tls', + 'smtp_use_ssl', + ]), + (_('Payment Gateways'), [ + # PayPal (from plugin) + 'payment_paypal_connect_client_id', # used only in signals (paypal plugin repo) + 'payment_paypal_connect_secret_key', # used only in signals (paypal plugin repo) + 'payment_paypal_connect_endpoint', # used only in signals (paypal plugin repo) + + # Stripe + 'payment_stripe_connect_client_id', # used only in signals (stripe plugin repo) + 'payment_stripe_connect_secret_key', + 'payment_stripe_connect_publishable_key', # used only in signals (stripe plugin repo) + 'payment_stripe_connect_test_secret_key', + 'payment_stripe_connect_test_publishable_key', # used only in signals (stripe plugin repo) + 'payment_stripe_connect_app_fee_percent', + 'payment_stripe_connect_app_fee_max', + 'payment_stripe_connect_app_fee_min', + + 'payment_stripe_secret_key', # used only in signals (this file) + 'payment_stripe_publishable_key', + 'payment_stripe_test_secret_key', # used only in signals (this file) + 'payment_stripe_test_publishable_key', # used only in signals (this file) + # new stripe webhook + 'stripe_webhook_secret_key', + ]), + (_('Ticket fee'), [ + 'ticket_fee_percentage', + ]), + (_('Maps'), [ + 'opencagedata_apikey', + 'mapquest_apikey', + 'leaflet_tiles', + 'leaflet_tiles_attribution', + ]), + ] + + class UpdateSettingsForm(SettingsForm): update_check_perform = forms.BooleanField( diff --git a/src/pretix/control/templates/pretixcontrol/global_settings.html b/src/pretix/control/templates/pretixcontrol/global_settings.html index 2824ef2888..9befccd536 100644 --- a/src/pretix/control/templates/pretixcontrol/global_settings.html +++ b/src/pretix/control/templates/pretixcontrol/global_settings.html @@ -1,6 +1,7 @@ {% extends "pretixcontrol/global_settings_base.html" %} {% load i18n %} {% load bootstrap3 %} +{% load getitem %} {% load static %} {% block custom_header %} @@ -11,10 +12,55 @@
{% csrf_token %} {% bootstrap_form_errors form %} - {% bootstrap_form form layout='control' %} + + +
+ {% for group_label, field_names in form.field_groups %} +
+ {% if group_label == "Payment Gateways" %} +
+ {% translate "Stripe" %} + {% for field_name in field_names %} + {% if "payment_stripe" in field_name or "stripe_webhook" in field_name %} + {% with form|getitem:field_name as field %} + {% bootstrap_field field layout='control' %} + {% endwith %} + {% endif %} + {% endfor %} +
+ +
+ {% translate "PayPal" %} + {% for field_name in field_names %} + {% if "payment_paypal" in field_name %} + {% with form|getitem:field_name as field %} + {% bootstrap_field field layout='control' %} + {% endwith %} + {% endif %} + {% endfor %} +
+ {% else %} + {% for field_name in field_names %} + {% with form|getitem:field_name as field %} + {% bootstrap_field field layout='control' %} + {% endwith %} + {% endfor %} + {% endif %} +
+ {% endfor %} +
+
diff --git a/src/pretix/control/templatetags/hierarkey_form.py b/src/pretix/control/templatetags/hierarkey_form.py index dbe14cfe74..9f2c9e682a 100644 --- a/src/pretix/control/templatetags/hierarkey_form.py +++ b/src/pretix/control/templatetags/hierarkey_form.py @@ -74,3 +74,8 @@ def propagated(parser, token): nodelist = parser.parse(('endpropagated',)) parser.delete_first_token() return PropagatedNode(nodelist, event, [f[1:-1] for f in args], url) + + +@register.filter +def get_item(dictionary, key): + return dictionary.get(key)