summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2020-07-10 14:27:31 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-07-17 10:29:24 +0200
commite7fa8aff432a90b6df9914d63aad239164b6b4d4 (patch)
tree5cfc6067488d1d21a12e072566e34a3a7bc2f583 /docs
parent18d4eac7fce6dfab6149ec7aba72f3c765b5722c (diff)
Improved ManyToManyField.through docs.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/fields.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index a72c9b3862..4e3cd108b9 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -1820,6 +1820,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
@@ -1851,7 +1858,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