Good to know, I'll keep that in mind.
Yes, I was mistaken. And I guess I missed that line in the docs. Thanks!
From: Tim Graham
Sent: Friday, July 20, 2018 4:54 PM
To: Django users
Subject: Re: python manage.py inspectdb makes all fields with a default valueblank=True, null=True
For future reference, creating a bug report is sufficient. No need to post to django-developers.
I'll post my analysis from the ticket below.
https://code.djangoproject.com/ticket/29583#comment:1
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 the documentation says, "database defaults aren't translated to model field defaults or detected in any fashion by inspectdb."
On Friday, July 20, 2018 at 4:10:57 PM UTC-4, Kimball Leavitt wrote:
Will do. Thanks.
On Friday, July 20, 2018 at 1:06:45 PM UTC-6, Jason wrote:Nice edge case you found. I would suggest raising this to the django-developers to get core framework dev attention or make a bug report on the tracker.
--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/-ZJ3Fwt6JIs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a189a49b-b9b6-4d00-adaa-42e94eb70e74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment