Setting the default value of the database field in the django model does not take effect

 The class in django views.py is as follows, the default value of the database field is set, default=0, but it cannot be reflected after it is created in the database. The table creation statement in the database is as follows,

The database does not have a default value: 

 

Search as follows. Django should not support setting default values. Too flexible, I don’t know if I am going to modify the table structure through SQL and there will be problems when operating these tables through ORM.

https://www.v2ex.com/amp/t/414616

Guess you like

Origin blog.csdn.net/weixin_48154829/article/details/108132428