Fix validation of total name length

Fixes PRETIXEU-6XM
This commit is contained in:
Raphael Michel
2022-06-27 12:15:48 +02:00
parent e62a5e18a2
commit e6e5c8f733

View File

@@ -253,7 +253,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 if v) > 250:
if sum(len(v) for v in value.values() if v) > 250:
raise forms.ValidationError(_('Please enter a shorter name.'), code='max_length')
return value