From 42c5a91388832b001321f2eb46c939eadc117b08 Mon Sep 17 00:00:00 2001 From: Gary Wilson Jr Date: Mon, 19 Nov 2007 04:07:03 +0000 Subject: [PATCH] Made use of `EMPTY_VALUES` in `ModelChoiceField.clean()`. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6699 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/newforms/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/newforms/models.py b/django/newforms/models.py index 4c783e4e9d..51ed16ff7f 100644 --- a/django/newforms/models.py +++ b/django/newforms/models.py @@ -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)