开发者

django models IntegerFields limits not working

I'm trying to limit the possible values of an IntegerField in my Django model.

I have read through this : How to limit the maximum value of a numeric field in a Django model?

...and this : Set Django IntegerField by choices=... name

and tried both.

Unfortunately, when I manually set the value of the field outside of the boundaries, then save the object, no exception is raised and the value is really stored.

Did I misunderstand how it worked, or did I d开发者_开发知识库o something wrong ?


The limits are applied to fields in a ModelForm; they are not enforced at the model or database level (although they conceivably could be).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜