#29583: python manage.py inspectdb makes all fields with a default value
blank=True, null=True
-------------------------------------+-------------------------------------
     Reporter:  Kimball Leavitt      |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Management     |                  Version:  2.0
  commands)                          |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  manage.py,           |             Triage Stage:
  inspectdb, models                  |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 I think you made a mistake in your analysis. In the `FieldInfo`
 initialization, `line[6]` (not `info.column_default`) corresponds to
 `row[6]` in `inspectdb`. In your example, `test_field int(11) DEFAULT 1`
 seems to be nullable (according to the MySQL documentation, "If neither
 NULL nor NOT NULL is specified, the column is treated as though NULL had
 been specified." -- I guess it's the same for MariaDB.

 As [https://docs.djangoproject.com/en/dev/ref/django-admin/#inspectdb the
 documentation] says, "database defaults aren’t translated to model field
 defaults or detected in any fashion by inspectdb."

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29583#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.7352efd357affac22e14b51ef191f531%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to