📅  最后修改于: 2022-03-11 14:45:19.623000             🧑  作者: Mango
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
class MyModel(models.Model):
qty = models.IntegerField(
default=1,
validators=[MaxValueValidator(100), MinValueValidator(1)]
)