diff options
| author | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-01-12 14:58:24 +0000 |
|---|---|---|
| committer | Joseph Kocherhans <joseph@jkocherhans.com> | 2010-01-12 14:58:24 +0000 |
| commit | 223b2721aa501a0603502d9dae499b7f21ae788f (patch) | |
| tree | bd75e7f401d978c928383abb8d8acd53d3e5ee6f /django | |
| parent | eb2cbb6db10c31123d6de07a9efe49c7e854cb86 (diff) | |
Fixed #12510. Changed ModelChoiceField to stop using some of its superclasses implementation. This could cause more than one query when generating choices. Thanks, Petr Marhoun and Honza Kral.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12211 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/forms/models.py | 6 |
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 |
