mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #36128 -- Clarified auto-generated unique constraint on m2m through models.
This commit is contained in:
parent
c09bceef68
commit
ae2736ca3b
3 changed files with 22 additions and 8 deletions
|
@ -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::
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue