model

MinValueValidator,MaxValueValidator

 from django.db import models
 from django.core.validators import MinValueValidator, MaxValueValidator
...
 size = models.IntegerField(validators=[MinValueValidator(0), MaxValueValidator(5)]) 

PositiveSmallIntegerField

max_attendees = models.PositiveSmallIntegerField(verbose_name="取值范围0~3W+" )

PositiveIntegerField

max_num = models.PositiveIntegerField(verbose_name=" 取值范围 0~2147483647")
上一篇:Npm 安装提示 EUNSUPPORTEDPROTOCOL 错误


下一篇:django学习之model