summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-01-31 20:55:00 +0100
committerClaude Paroz <claude@2xlibre.net>2013-01-31 20:55:00 +0100
commit7bbd17bf20e46283954aead2750c24642fd8d9f9 (patch)
treea31fc16fa1a5b2861e1fa1759d9aff4ffcf1bb67 /django
parent3c0a81aaf0a4ba675f80d50c788aea706d0c812c (diff)
Fixed #19341 -- Detected NullBooleanField when introspecting models
Thanks Tim Bowden for the report.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/inspectdb.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
index 08870af56b..8fab69de59 100644
--- a/django/core/management/commands/inspectdb.py
+++ b/django/core/management/commands/inspectdb.py
@@ -108,9 +108,12 @@ class Command(NoArgsCommand):
# Add 'null' and 'blank', if the 'null_ok' flag was present in the
# table description.
if row[6]: # If it's NULL...
- extra_params['blank'] = True
- if not field_type in ('TextField(', 'CharField('):
- extra_params['null'] = True
+ if field_type == 'BooleanField(':
+ field_type = 'NullBooleanField('
+ else:
+ extra_params['blank'] = True
+ if not field_type in ('TextField(', 'CharField('):
+ extra_params['null'] = True
field_desc = '%s = models.%s' % (att_name, field_type)
if extra_params: