diff options
| author | Tim Graham <timograham@gmail.com> | 2018-01-05 15:49:54 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2018-01-05 15:49:54 -0500 |
| commit | ec2ce4517ac89f6c6334fe5322d1fc2007dfcbd4 (patch) | |
| tree | 491ccf9d7c556ca46442af52b42ec71a260d077c /django | |
| parent | 3333d935d2914cd80cf31f4803821ad5c0e2a51d (diff) | |
Fixed #28882 -- Fixed cleaning of disabled MultiValueFields.
Thanks avalanchy for the initial patch.
Diffstat (limited to 'django')
| -rw-r--r-- | django/forms/fields.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/django/forms/fields.py b/django/forms/fields.py index 2019a43c73..3b15c1b021 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -970,6 +970,8 @@ class MultiValueField(Field): for f in fields: f.error_messages.setdefault('incomplete', self.error_messages['incomplete']) + if self.disabled: + f.disabled = True if self.require_all_fields: # Set 'required' to False on the individual fields, because the # required validation will be handled by MultiValueField, not @@ -996,6 +998,8 @@ class MultiValueField(Field): """ clean_data = [] errors = [] + if self.disabled and not isinstance(value, list): + value = self.widget.decompress(value) if not value or isinstance(value, (list, tuple)): if not value or not [v for v in value if v not in self.empty_values]: if self.required: |
