mirror of
https://github.com/django/django.git
synced 2024-12-01 15:42:04 +01:00
Fixed #14481 -- Documented implicit "through" class created by ManyToManyField.
Thanks to jonathanmorgan for the report and initial patch.
This commit is contained in:
parent
d015c9d11c
commit
de90129070
@ -1342,6 +1342,19 @@ that control how the relationship functions.
|
||||
:ref:`extra data with a many-to-many relationship
|
||||
<intermediary-manytomany>`.
|
||||
|
||||
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:
|
||||
|
||||
* ``id``: the primary key of the relation.
|
||||
* ``<containing_model>_id``: the ``id`` of the model that declares the
|
||||
``ManyToManyField``.
|
||||
* ``<other_model>_id``: the ``id`` of the model that the
|
||||
``ManyToManyField`` points to.
|
||||
|
||||
This class can be used to query associated records for a given model
|
||||
instance like a normal model.
|
||||
|
||||
.. attribute:: ManyToManyField.through_fields
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
Loading…
Reference in New Issue
Block a user