forked from CGM_Public/pretix_original
Add a label for empty salutation option (Z#23183319) (#4913)
This commit is contained in:
@@ -127,7 +127,13 @@ class NamePartsWidget(forms.MultiWidget):
|
|||||||
if fname == 'title' and self.titles:
|
if fname == 'title' and self.titles:
|
||||||
widgets.append(Select(attrs=a, choices=[('', '')] + [(d, d) for d in self.titles[1]]))
|
widgets.append(Select(attrs=a, choices=[('', '')] + [(d, d) for d in self.titles[1]]))
|
||||||
elif fname == 'salutation':
|
elif fname == 'salutation':
|
||||||
widgets.append(Select(attrs=a, choices=[('', '---'), ('empty', '')] + PERSON_NAME_SALUTATIONS))
|
widgets.append(Select(
|
||||||
|
attrs=a,
|
||||||
|
choices=[
|
||||||
|
('', '---'),
|
||||||
|
('empty', '({})'.format(pgettext_lazy("name_salutation", "not specified"))),
|
||||||
|
] + PERSON_NAME_SALUTATIONS
|
||||||
|
))
|
||||||
else:
|
else:
|
||||||
widgets.append(self.widget(attrs=a))
|
widgets.append(self.widget(attrs=a))
|
||||||
super().__init__(widgets, attrs)
|
super().__init__(widgets, attrs)
|
||||||
@@ -245,7 +251,10 @@ class NamePartsFormField(forms.MultiValueField):
|
|||||||
d.pop('validators', None)
|
d.pop('validators', None)
|
||||||
field = forms.ChoiceField(
|
field = forms.ChoiceField(
|
||||||
**d,
|
**d,
|
||||||
choices=[('', '---'), ('empty', '')] + PERSON_NAME_SALUTATIONS
|
choices=[
|
||||||
|
('', '---'),
|
||||||
|
('empty', '({})'.format(pgettext_lazy("name_salutation", "not specified"))),
|
||||||
|
] + PERSON_NAME_SALUTATIONS
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
field = forms.CharField(**defaults)
|
field = forms.CharField(**defaults)
|
||||||
|
|||||||
Reference in New Issue
Block a user