mirror of
https://github.com/django/django.git
synced 2025-07-07 11:19:12 +00:00
[soc2009/model-validation] Have model fields use EMPTY_VALUES from validators
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10945 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
3e625f2667
commit
ca9cecb702
@ -14,7 +14,7 @@ from django.db.models.query_utils import QueryWrapper
|
|||||||
from django.dispatch import dispatcher
|
from django.dispatch import dispatcher
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core import exceptions
|
from django.core import exceptions, validators
|
||||||
from django.utils.datastructures import DictWrapper
|
from django.utils.datastructures import DictWrapper
|
||||||
from django.utils.functional import curry
|
from django.utils.functional import curry
|
||||||
from django.utils.itercompat import tee
|
from django.utils.itercompat import tee
|
||||||
@ -135,7 +135,7 @@ class Field(object):
|
|||||||
ugettext_lazy("This field cannot be null."))
|
ugettext_lazy("This field cannot be null."))
|
||||||
|
|
||||||
# cannot do if not value because of 0 passed to integer fields
|
# cannot do if not value because of 0 passed to integer fields
|
||||||
if not self.blank and value in ( None, '' ):
|
if not self.blank and value in validators.EMPTY_VALUES:
|
||||||
raise exceptions.ValidationError(
|
raise exceptions.ValidationError(
|
||||||
ugettext_lazy("This field cannot be blank."))
|
ugettext_lazy("This field cannot be blank."))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user