Opened 18 years ago
Closed 18 years ago
#4800 closed (duplicate)
Field's default value in model isn't passed to SQL
Description ¶
I have a model roughly like this:
class Foo(models.Model): blah = models.BooleanField(default=True)
I expect "syncdb" to create SQL field with the default value set (this is for mysql):
`blah` tinyint(1) NOT NULL DEFAULT '1',
Unfortunately it doesn't, the "DEFAULT '1'" part is missing. Apparently there is no checking for 'field.default' value in django/core/management.py:_get_sql_model_create()
Attached patch adds this functionality.
Change History (3)
by , 18 years ago
Attachment: | db-default.diff added |
---|
comment:1 by , 18 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:2 by , 18 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Dupe of #470 (which has been wontfixed twice so far).
Note:
See TracTickets
for help on using tickets.
A couple things:
BooleanField
.