1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #26970 -- Fixed crash with disabled ModelMultipleChoiceField.

This commit is contained in:
Tim Graham
2016-07-30 10:13:10 -04:00
parent 36fbf9b7d1
commit 4e86168290
2 changed files with 26 additions and 0 deletions

View File

@@ -1251,6 +1251,7 @@ class ModelMultipleChoiceField(ModelChoiceField):
return list(self._check_values(value))
def clean(self, value):
value = self.prepare_value(value)
if self.required and not value:
raise ValidationError(self.error_messages['required'], code='required')
elif not self.required and not value: