summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/models.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index 817de5e9b2..cce2319471 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -903,8 +903,7 @@ class ModelChoiceField(ChoiceField):
choices = property(_get_choices, ChoiceField._set_choices)
- def clean(self, value):
- Field.clean(self, value)
+ def to_python(self, value):
if value in EMPTY_VALUES:
return None
try:
@@ -914,6 +913,9 @@ class ModelChoiceField(ChoiceField):
raise ValidationError(self.error_messages['invalid_choice'])
return value
+ def validate(self, value):
+ return Field.validate(self, value)
+
class ModelMultipleChoiceField(ModelChoiceField):
"""A MultipleChoiceField whose choices are a model QuerySet."""
widget = SelectMultiple