Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

magic-removal: Fixed #1562 -- Added null and blank detection to 'insp…

…ectdb'. Appears only to work for MySQL at this point.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2692 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 47333f6d1e3086aa0fb7d0bddb888bea8fb76526 1 parent 93d95b3
@adrianholovaty adrianholovaty authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 django/core/management.py
View
7 django/core/management.py
@@ -753,6 +753,13 @@ def table2model(table_name):
if att_name == 'id' and field_type == 'AutoField(' and extra_params == {'primary_key': True}:
continue
+ # 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
+
field_desc = '%s = models.%s' % (att_name, field_type)
if extra_params:
if not field_desc.endswith('('):
Please sign in to comment.
Something went wrong with that request. Please try again.