summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/checks.txt2
-rw-r--r--docs/ref/models/fields.txt21
-rw-r--r--docs/releases/3.0.txt3
3 files changed, 19 insertions, 7 deletions
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt
index a15eb558fe..1a388c6b37 100644
--- a/docs/ref/checks.txt
+++ b/docs/ref/checks.txt
@@ -222,7 +222,7 @@ Related fields
* **fields.E331**: Field specifies a many-to-many relation through model
``<model>``, which has not been installed.
* **fields.E332**: Many-to-many fields with intermediate tables must not be
- symmetrical.
+ symmetrical. *This check appeared before Django 3.0.*
* **fields.E333**: The model is used as an intermediate model by ``<model>``,
but it has more than two foreign keys to ``<model>``, which is ambiguous.
You must specify which two foreign keys Django should use via the
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 7ca6b2c619..758c21c7bc 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -1537,6 +1537,11 @@ that control how the relationship functions.
add the descriptor for the reverse relationship, allowing
:class:`ManyToManyField` relationships to be non-symmetrical.
+ .. versionchanged:: 3.0
+
+ Specifying ``symmetrical=True`` for recursive many-to-many
+ relationships using an intermediary model was allowed.
+
.. attribute:: ManyToManyField.through
Django will automatically generate a table to manage many-to-many
@@ -1549,6 +1554,16 @@ that control how the relationship functions.
:ref:`extra data with a many-to-many relationship
<intermediary-manytomany>`.
+ .. 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
+ the reverse accessors names, as they would be the same. You need to set
+ a :attr:`~ForeignKey.related_name` to at least one of them. If you'd
+ prefer Django not to create a backwards relation, set ``related_name``
+ to ``'+'``.
+
If you don't specify an explicit ``through`` model, there is still an
implicit ``through`` model class you can use to directly access the table
created to hold the association. It has three fields to link the models.
@@ -1624,12 +1639,6 @@ that control how the relationship functions.
foreign keys to the model, or you want to explicitly specify which two
Django should use.
- Recursive relationships using an intermediary model are always defined as
- non-symmetrical -- that is, with :attr:`symmetrical=False <ManyToManyField.symmetrical>`
- -- therefore, there is the concept of a "source" and a "target". In that
- case ``'field1'`` will be treated as the "source" of the relationship and
- ``'field2'`` as the "target".
-
.. attribute:: ManyToManyField.db_table
The name of the table to create for storing the many-to-many data. If this
diff --git a/docs/releases/3.0.txt b/docs/releases/3.0.txt
index 51d7f7c8bf..62c6080cf7 100644
--- a/docs/releases/3.0.txt
+++ b/docs/releases/3.0.txt
@@ -254,6 +254,9 @@ Models
* :class:`~django.db.models.FilePathField` now accepts a callable ``path``.
+* Allowed symmetrical intermediate table for self-referential
+ :class:`~django.db.models.ManyToManyField`.
+
Requests and Responses
~~~~~~~~~~~~~~~~~~~~~~