diff options
| author | Adam Johnson <me@adamj.eu> | 2020-07-10 14:27:31 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-07-17 10:48:32 +0200 |
| commit | 5bd7c18306c265dcc03baac4fe0131d5626a6b9f (patch) | |
| tree | a5db6f29e06537ef3a94fb2b9ca962c1d09dbc7a /docs | |
| parent | 051e6f58ea0260a99e3b96e5d2ad5d39f51e4a7b (diff) | |
[3.0.x] Improved ManyToManyField.through docs.
Backport of e7fa8aff432a90b6df9914d63aad239164b6b4d4 from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/fields.txt | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 2fad2d64b7..4acf47c188 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -1715,6 +1715,13 @@ that control how the relationship functions. .. note:: + If you don't want multiple associations between the same instances, add + a :class:`~django.db.models.UniqueConstraint` including the from and to + fields. Django's automatically generated many-to-many tables include + such a constraint. + + .. note:: + Recursive relationships using an intermediary model and defined as symmetrical (that is, with :attr:`symmetrical=True <ManyToManyField.symmetrical>`, which is the default) can't determine @@ -1746,7 +1753,9 @@ that control how the relationship functions. points (i.e. the target model instance). This class can be used to query associated records for a given model - instance like a normal model. + instance like a normal model:: + + Model.m2mfield.through.objects.all() .. attribute:: ManyToManyField.through_fields |
