Add salutation "Mx", normalize salutations (save in English, localize on display) (#2075)

* normalize salutations and localize before use

* add migration to normalize salutations

* add placeholder "name_for_salutation" for emails
This commit is contained in:
Richard Schreiber
2021-05-14 09:51:25 +02:00
committed by GitHub
parent cf9fd47d2b
commit 8c07fa75e4
4 changed files with 111 additions and 7 deletions

View File

@@ -119,7 +119,7 @@ class NamePartsWidget(forms.MultiWidget):
if fname == 'title' and self.titles:
widgets.append(Select(attrs=a, choices=[('', '')] + [(d, d) for d in self.titles[1]]))
elif fname == 'salutation':
widgets.append(Select(attrs=a, choices=[('', '---')] + [(s, s) for s in PERSON_NAME_SALUTATIONS]))
widgets.append(Select(attrs=a, choices=[('', '---')] + PERSON_NAME_SALUTATIONS))
else:
widgets.append(self.widget(attrs=a))
super().__init__(widgets, attrs)
@@ -217,7 +217,7 @@ class NamePartsFormField(forms.MultiValueField):
d.pop('max_length', None)
field = forms.ChoiceField(
**d,
choices=[('', '---')] + [(s, s) for s in PERSON_NAME_SALUTATIONS]
choices=[('', '---')] + PERSON_NAME_SALUTATIONS
)
else:
field = forms.CharField(**defaults)