Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved ManyToManyField.through docs. #13174

Merged
merged 1 commit into from
Jul 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/ref/models/fields.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1818,6 +1818,13 @@ that control how the relationship functions.
:ref:`extra data with a many-to-many relationship
<intermediary-manytomany>`.

.. 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
Expand Down Expand Up @@ -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

Expand Down