Made use of `EMPTY_VALUES` in `ModelChoiceField.clean()`.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6699 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Gary Wilson Jr 2007-11-19 04:07:03 +00:00
parent 66576c285a
commit 42c5a91388
1 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ from django.utils.datastructures import SortedDict
from util import ValidationError
from forms import BaseForm
from fields import Field, ChoiceField
from fields import Field, ChoiceField, EMPTY_VALUES
from widgets import Select, SelectMultiple, MultipleHiddenInput
__all__ = (
@ -200,7 +200,7 @@ class ModelChoiceField(ChoiceField):
def clean(self, value):
Field.clean(self, value)
if value in ('', None):
if value in EMPTY_VALUES:
return None
try:
value = self.queryset.get(pk=value)