Skip to content

Commit 0af263a

Browse files
committed
fix i18n issue
1 parent b56dc42 commit 0af263a

File tree

3 files changed

+26
-31
lines changed

3 files changed

+26
-31
lines changed

app/eventyay/control/forms/global_settings.py

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -271,28 +271,19 @@ def __init__(self, *args, **kwargs):
271271
)
272272

273273
self.field_groups = [
274-
(_('Basics'), [
275-
'footer_text',
276-
'footer_link',
277-
'banner_message',
278-
'banner_message_detail',
274+
('basics', _('Basics'), [
275+
'footer_text', 'footer_link', 'banner_message', 'banner_message_detail',
279276
]),
280-
(_('Localization'), [
277+
('localization', _('Localization'), [
281278
'region',
282279
]),
283-
(_('Email'), [
284-
'mail_from',
285-
'email_vendor',
286-
'send_grid_api_key',
287-
'smtp_host',
288-
'smtp_port',
289-
'smtp_username',
290-
'smtp_password',
291-
'smtp_use_tls',
292-
'smtp_use_ssl',
280+
('email', _('Email'), [
281+
'mail_from', 'email_vendor', 'send_grid_api_key',
282+
'smtp_host', 'smtp_port', 'smtp_username', 'smtp_password',
283+
'smtp_use_tls', 'smtp_use_ssl',
293284
]),
294-
(_('Payment Gateways'), [
295-
# PayPal (from plugin)
285+
('payment_gateways', _('Payment Gateways'), [
286+
# PayPal
296287
'payment_paypal_connect_client_id',
297288
'payment_paypal_connect_secret_key',
298289
'payment_paypal_connect_endpoint',
@@ -311,22 +302,17 @@ def __init__(self, *args, **kwargs):
311302
'payment_stripe_publishable_key',
312303
'payment_stripe_test_secret_key',
313304
'payment_stripe_test_publishable_key',
314-
# new stripe webhook
315305
'stripe_webhook_secret_key',
316306
]),
317-
(_('Ticket fee'), [
307+
('ticket_fee', _('Ticket fee'), [
318308
'ticket_fee_percentage',
319309
]),
320-
(_('Maps'), [
321-
'opencagedata_apikey',
322-
'mapquest_apikey',
323-
'leaflet_tiles',
324-
'leaflet_tiles_attribution',
310+
('maps', _('Maps'), [
311+
'opencagedata_apikey', 'mapquest_apikey', 'leaflet_tiles', 'leaflet_tiles_attribution',
325312
]),
326313
]
327314

328315

329-
330316
class UpdateSettingsForm(SettingsForm):
331317
update_check_perform = forms.BooleanField(
332318
required=False,

app/eventyay/control/templates/pretixcontrol/global_settings.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{% csrf_token %}
1414
{% bootstrap_form_errors form %}
1515
<ul class="nav nav-tabs" role="tablist">
16-
{% for group_label, field_names in form.field_groups %}
16+
{% for group_key, group_label, field_names in form.field_groups %}
1717
<li role="presentation" class="{% if forloop.first %}active{% endif %}">
1818
<a href="#tab{{ forloop.counter }}" aria-controls="tab{{ forloop.counter }}" role="tab" data-toggle="tab">
1919
{{ group_label }}
@@ -23,9 +23,9 @@
2323
</ul>
2424

2525
<div class="tab-content">
26-
{% for group_label, field_names in form.field_groups %}
26+
{% for group_key, group_label, field_names in form.field_groups %}
2727
<div role="tabpanel" class="tab-pane {% if forloop.first %}active{% endif %}" id="tab{{ forloop.counter }}">
28-
{% if group_label == "Payment Gateways" %}
28+
{% if group_key == "payment_gateways" %}
2929
<fieldset>
3030
<legend>{% translate "Stripe" %}</legend>
3131
{% for field_name in field_names %}

app/eventyay/control/templatetags/hierarkey_form.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,14 @@ def propagated(parser, token):
7777

7878

7979
@register.filter
80-
def getitem(dictionary, key):
81-
return dictionary.get(key)
80+
def getitem(value, key):
81+
"""
82+
Template filter to safely access dictionary or object attributes by key.
83+
Example: {{ form|getitem:field_name }}
84+
"""
85+
try:
86+
if isinstance(value, dict):
87+
return value.get(key)
88+
return getattr(value, key, None)
89+
except Exception:
90+
return None

0 commit comments

Comments
 (0)