diff options
| author | Jorge C. Leitão <jorgecarleitao@gmail.com> | 2014-06-16 21:30:26 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-06-18 12:38:49 -0400 |
| commit | 807aadaaad317b67965052048b3a2fb92a1aaa79 (patch) | |
| tree | 0c39bf692d4a8cc3d9de3baf4580ba56726af03f /docs/ref/models/fields.txt | |
| parent | 1d9f308fa19b7740cf9bd28ddada52b572e25c3a (diff) | |
[1.7.x] Fixed #14481 -- Documented implicit "through" class created by ManyToManyField.
Thanks to jonathanmorgan for the report and initial patch.
Backport of de90129070 from master
Diffstat (limited to 'docs/ref/models/fields.txt')
| -rw-r--r-- | docs/ref/models/fields.txt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 52f02e1b29..054547f89b 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -1349,6 +1349,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 |
