From 4390403b9a4c18867428cd457fdfe4531a0300e3 Mon Sep 17 00:00:00 2001 From: Martin Gross Date: Tue, 1 Sep 2026 10:21:20 +0200 Subject: [PATCH] Add label-overrides to contact_form_fields_overrides and question_form_fields_overrides (Z#23244154) (#6504) --- src/pretix/base/views/mixins.py | 2 ++ src/pretix/presale/checkoutflow.py | 4 ++++ src/pretix/presale/signals.py | 8 ++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/pretix/base/views/mixins.py b/src/pretix/base/views/mixins.py index 157f805430..386e991ee0 100644 --- a/src/pretix/base/views/mixins.py +++ b/src/pretix/base/views/mixins.py @@ -135,6 +135,8 @@ class BaseQuestionsViewMixin: question_field.initial = getattr(question_field, 'initial', None) or src['initial'] if 'validators' in src: question_field.validators += src['validators'] + if 'label' in src: + question_field.label = src['label'] if len(form.fields) > 0: formlist.append(form) diff --git a/src/pretix/presale/checkoutflow.py b/src/pretix/presale/checkoutflow.py index 0507932a53..a4981316cb 100644 --- a/src/pretix/presale/checkoutflow.py +++ b/src/pretix/presale/checkoutflow.py @@ -840,6 +840,8 @@ class QuestionsStep(CartQuestionsViewMixin, CartMixin, TemplateFlowStep): f.fields[fname].disabled = val['disabled'] if 'validators' in val and fname in f.fields: f.fields[fname].validators += val['validators'] + if 'label' in val and fname in f.fields: + f.fields[fname].label = val['label'] return f @@ -944,6 +946,8 @@ class QuestionsStep(CartQuestionsViewMixin, CartMixin, TemplateFlowStep): f.fields[fname].disabled = val['disabled'] if 'validators' in val and fname in f.fields: f.fields[fname].validators += val['validators'] + if 'label' in val and fname in f.fields: + f.fields[fname].label = val['label'] return f diff --git a/src/pretix/presale/signals.py b/src/pretix/presale/signals.py index 007f9f459b..3eeea867cd 100644 --- a/src/pretix/presale/signals.py +++ b/src/pretix/presale/signals.py @@ -233,7 +233,7 @@ Arguments: ``request``, ``order`` This signal allows you to override fields of the contact form that is presented during checkout and by default only asks for the email address. It is also being used for the invoice address form. You are supposed to return a dictionary of dictionaries with globally unique keys. The -value-dictionary should contain one or more of the following keys: ``initial``, ``disabled``, +value-dictionary should contain one or more of the following keys: ``label``, ``initial``, ``disabled``, ``validators``. The key of the dictionary should be the name of the form field. As with all event plugin signals, the ``sender`` keyword argument will contain the event. A ``request`` @@ -264,9 +264,9 @@ Arguments: ``position``, ``request`` This signal allows you to override fields of the questions form that is presented during checkout and by default only asks for the questions configured in the backend. You are supposed to return a dictionary of dictionaries with globally unique keys. The value-dictionary should contain one or -more of the following keys: ``initial``, ``disabled``, ``validators``. The key of the dictionary -should be the form field name for system fields (e.g. ``company``), or the question's ``identifier`` -for user-defined questions. +more of the following keys: ``label``, ``initial``, ``disabled``, ``validators``. The key of the +dictionary should be the form field name for system fields (e.g. ``company``), or the question's +``identifier`` for user-defined questions. The ``position`` keyword argument will contain a ``CartPosition`` or ``OrderPosition`` object.