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:06:09 +0100 |
| commit | ae2736ca3bf4c6a27e23ee95530ad965b550d4cc (patch) | |
| tree | 4b20178ac5f620ac2a5e6dd3f2eea2bdd3aa5f5e /docs/ref/contrib/admin | |
| parent | c09bceef68e5abb79accedd12dade16aa6577a09 (diff) | |
Fixed #36128 -- Clarified auto-generated unique constraint on m2m through models.
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 9fc5744dbd..1f4e5eafbb 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -2614,6 +2614,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:: |
