Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)]
     )
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #django #model #range #validation
ADD COMMENT
Topic
Name
2+2 =