diff --git a/django/core/management/validation.py b/django/core/management/validation.py
index 68bfb6c..31a5604 100644
a
|
b
|
def get_validation_errors(outfile, app=None):
|
51 | 51 | from PIL import Image |
52 | 52 | except ImportError: |
53 | 53 | 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) |
| 54 | if isinstance(f, models.BooleanField) and getattr(f, 'null', False): |
| 55 | e.add(opts, '"%s": BooleanFields cannot allow null values. Use NullBooleanField instead.' % f.name) |
54 | 56 | if f.choices: |
55 | 57 | if isinstance(f.choices, basestring) or not is_iterable(f.choices): |
56 | 58 | e.add(opts, '"%s": "choices" should be iterable (e.g., a tuple or list).' % f.name) |
diff --git a/tests/modeltests/invalid_models/models.py b/tests/modeltests/invalid_models/models.py
index 2817208..0fa4a7c 100644
a
|
b
|
class FieldErrors(models.Model):
|
14 | 14 | choices2 = models.CharField(max_length=10, choices=[(1,2,3),(1,2,3)]) |
15 | 15 | index = models.CharField(max_length=10, db_index='bad') |
16 | 16 | field_ = models.CharField(max_length=10) |
| 17 | nullbool = models.BooleanField(null=True) |
17 | 18 | |
18 | 19 | class Target(models.Model): |
19 | 20 | tgt_safe = models.CharField(max_length=10) |
… |
… |
invalid_models.fielderrors: "choices2": "choices" should be a sequence of two-tu
|
190 | 191 | invalid_models.fielderrors: "choices2": "choices" should be a sequence of two-tuples. |
191 | 192 | invalid_models.fielderrors: "index": "db_index" should be either None, True or False. |
192 | 193 | invalid_models.fielderrors: "field_": Field names cannot end with underscores, because this would lead to ambiguous queryset filters. |
| 194 | invalid_models.fielderrors: "nullbool": BooleanFields cannot allow null values. Use NullBooleanField instead. |
193 | 195 | invalid_models.clash1: Accessor for field 'foreign' clashes with field 'Target.clash1_set'. Add a related_name argument to the definition for 'foreign'. |
194 | 196 | invalid_models.clash1: Accessor for field 'foreign' clashes with related m2m field 'Target.clash1_set'. Add a related_name argument to the definition for 'foreign'. |
195 | 197 | invalid_models.clash1: Reverse query name for field 'foreign' clashes with field 'Target.clash1'. Add a related_name argument to the definition for 'foreign'. |
diff --git a/tests/regressiontests/serializers_regress/models.py b/tests/regressiontests/serializers_regress/models.py
index e26b8df..95119d4 100644
a
|
b
|
from django.contrib.contenttypes.models import ContentType
|
11 | 11 | from django.contrib.localflavor.us.models import USStateField, PhoneNumberField |
12 | 12 | |
13 | 13 | # The following classes are for testing basic data |
14 | | # marshalling, including NULL values. |
| 14 | # marshalling, including NULL values, where allowed. |
15 | 15 | |
16 | 16 | class BooleanData(models.Model): |
17 | | data = models.BooleanField(null=True) |
| 17 | data = models.BooleanField() |
18 | 18 | |
19 | 19 | class CharData(models.Model): |
20 | 20 | data = models.CharField(max_length=30, null=True) |