Django - Custom Database Constraints


Django tip:

You can add custom database constraints to your Django models like so:

class Child(models.Model):  

    ....

    class Meta:
        constraints = [
            models.CheckConstraint(check=models.Q(age__lt=18))
        ]