About Minimal and Maximal Values for Numeric Fields

You can set the minimal and maximal values for a numeric field using Django validators:

from django.db import models
from django.core.validators import (
    MinValueValidator, MaxValueValidator
)

class Process(models.Model):
    progress = models.IntegerField(
        validators = [
            MinValueValidator(0), 
            MaxValueValidator(100)
        ]
    )

Tips and Tricks Programming Architecture Django 4.2 Django 3.2 Django 2.2