开发者

Setting default value for integer field in django models

I'm trying to set a default value for the integer field in Django model using

models.Pos开发者_高级运维itiveSmallIntegerField(default='0')

Why isn't it working?


The default value in your example is set to string ('0'), but it should be integer. Try this instead:

models.PositiveSmallIntegerField(default=0)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜