1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #35676 -- Made BaseModelForm validate constraints that reference an InlineForeignKeyField.

Co-authored-by: Simon Charette <charette.s@gmail.com>
This commit is contained in:
Clifford Gama
2025-03-08 15:46:58 +02:00
committed by Sarah Boyce
parent 5183f7c287
commit 0ebea6e5c0
7 changed files with 135 additions and 13 deletions

View File

@@ -15,6 +15,11 @@ class Child(models.Model):
school = models.ForeignKey(School, models.CASCADE)
name = models.CharField(max_length=100)
class Meta:
constraints = [
models.UniqueConstraint("mother", "father", name="unique_parents"),
]
class Poet(models.Model):
name = models.CharField(max_length=100)