mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Set max_length to 70 but for all name fields together and not only every single one.
This commit is contained in:
committed by
Martin Gross
parent
5faa85ed40
commit
7e457f7430
@@ -235,6 +235,7 @@ class NamePartsFormField(forms.MultiValueField):
|
||||
)
|
||||
]
|
||||
}
|
||||
self.max_length = defaults['max_length']
|
||||
self.scheme_name = kwargs.pop('scheme')
|
||||
self.titles = kwargs.pop('titles')
|
||||
self.scheme = PERSON_NAME_SCHEMES.get(self.scheme_name)
|
||||
@@ -292,7 +293,7 @@ class NamePartsFormField(forms.MultiValueField):
|
||||
if self.require_all_fields and not all(v for v in value):
|
||||
raise forms.ValidationError(self.error_messages['incomplete'], code='required')
|
||||
|
||||
if sum(len(v) for v in value.values() if v) > 250:
|
||||
if sum(len(v) for v in value.values() if v) > (self.max_length or 250):
|
||||
raise forms.ValidationError(_('Please enter a shorter name.'), code='max_length')
|
||||
|
||||
if value.get("salutation") == "empty":
|
||||
|
||||
@@ -172,7 +172,7 @@ class RegistrationForm(forms.Form):
|
||||
)
|
||||
|
||||
self.fields['name_parts'] = NamePartsFormField(
|
||||
max_length=35,
|
||||
max_length=70,
|
||||
required=True,
|
||||
scheme=request.organizer.settings.name_scheme,
|
||||
titles=request.organizer.settings.name_scheme_titles,
|
||||
|
||||
Reference in New Issue
Block a user