Skip to content

Commit dba1b85

Browse files
committed
fix i18n issue
1 parent 2ee96c7 commit dba1b85

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
@@ -282,28 +282,19 @@ def __init__(self, *args, **kwargs):
282282
)
283283

284284
self.field_groups = [
285-
(_('Basics'), [
286-
'footer_text',
287-
'footer_link',
288-
'banner_message',
289-
'banner_message_detail',
285+
('basics', _('Basics'), [
286+
'footer_text', 'footer_link', 'banner_message', 'banner_message_detail',
290287
]),
291-
(_('Localization'), [
288+
('localization', _('Localization'), [
292289
'region',
293290
]),
294-
(_('Email'), [
295-
'mail_from',
296-
'email_vendor',
297-
'send_grid_api_key',
298-
'smtp_host',
299-
'smtp_port',
300-
'smtp_username',
301-
'smtp_password',
302-
'smtp_use_tls',
303-
'smtp_use_ssl',
291+
('email', _('Email'), [
292+
'mail_from', 'email_vendor', 'send_grid_api_key',
293+
'smtp_host', 'smtp_port', 'smtp_username', 'smtp_password',
294+
'smtp_use_tls', 'smtp_use_ssl',
304295
]),
305-
(_('Payment Gateways'), [
306-
# PayPal (from plugin)
296+
('payment_gateways', _('Payment Gateways'), [
297+
# PayPal
307298
'payment_paypal_connect_client_id',
308299
'payment_paypal_connect_secret_key',
309300
'payment_paypal_connect_endpoint',
@@ -322,22 +313,17 @@ def __init__(self, *args, **kwargs):
322313
'payment_stripe_publishable_key',
323314
'payment_stripe_test_secret_key',
324315
'payment_stripe_test_publishable_key',
325-
# new stripe webhook
326316
'stripe_webhook_secret_key',
327317
]),
328-
(_('Ticket fee'), [
318+
('ticket_fee', _('Ticket fee'), [
329319
'ticket_fee_percentage',
330320
]),
331-
(_('Maps'), [
332-
'opencagedata_apikey',
333-
'mapquest_apikey',
334-
'leaflet_tiles',
335-
'leaflet_tiles_attribution',
321+
('maps', _('Maps'), [
322+
'opencagedata_apikey', 'mapquest_apikey', 'leaflet_tiles', 'leaflet_tiles_attribution',
336323
]),
337324
]
338325

339326

340-
341327
class UpdateSettingsForm(SettingsForm):
342328
update_check_perform = forms.BooleanField(
343329
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)