1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #5563: BooleanField(null=True) now raises a validation warning telling users to use NullBooleanField instead. Thanks, SamBull.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10456 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss
2009-04-09 15:09:35 +00:00
parent c0ad626dca
commit de91850944
3 changed files with 6 additions and 2 deletions

View File

@@ -51,6 +51,8 @@ def get_validation_errors(outfile, app=None):
from PIL import Image
except ImportError:
e.add(opts, '"%s": To use ImageFields, you need to install the Python Imaging Library. Get it at http://www.pythonware.com/products/pil/ .' % f.name)
if isinstance(f, models.BooleanField) and getattr(f, 'null', False):
e.add(opts, '"%s": BooleanFields do not accept null values. Use a NullBooleanField instead.' % f.name)
if f.choices:
if isinstance(f.choices, basestring) or not is_iterable(f.choices):
e.add(opts, '"%s": "choices" should be iterable (e.g., a tuple or list).' % f.name)