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)
精彩评论