Answers for "python django model range validation"

0

python django model range validation

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)]
     )
Posted by: Guest on August-27-2021

Python Answers by Framework

Browse Popular Code Answers by Language