mirror of
https://github.com/pretix/pretix.git
synced 2026-08-29 13:44:40 +00:00
Add label-overrides to contact_form_fields_overrides and question_form_fields_overrides (Z#23244154)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user