diff options
| author | Clifford Gama <cliffygamy@gmail.com> | 2025-02-10 09:52:27 +0200 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2025-03-04 13:08:01 +0100 |
| commit | cc405e154649af37e1741aeb4438391943133c29 (patch) | |
| tree | 0ee9944b86d3e124d923c7b9d15ce857ea01cff1 /docs/ref/contrib/admin | |
| parent | 03ace756eafc3f7a85f5b84d28ce1e7ce092c018 (diff) | |
[5.1.x] Fixed #36128 -- Clarified auto-generated unique constraint on m2m through models.
Backport of ae2736ca3bf4c6a27e23ee95530ad965b550d4cc from main.
Diffstat (limited to 'docs/ref/contrib/admin')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 4a8b52c18f..39dc4386cb 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -2635,6 +2635,13 @@ we can do this with inline admin models. Suppose we have the following models:: date_joined = models.DateField() invite_reason = models.CharField(max_length=64) + class Meta: + constraints = [ + models.UniqueConstraint( + fields=["person", "group"], name="unique_person_group" + ) + ] + The first step in displaying this intermediate model in the admin is to define an inline class for the ``Membership`` model:: |
