Skip to content

Commit

Permalink
[3.1.x] Refs #9475 -- Linked through_default docs to related managers…
Browse files Browse the repository at this point in the history
… methods.

Backport of 284bde3 from master
  • Loading branch information
charettes authored and felixxm committed Oct 22, 2020
1 parent b37d584 commit 8aedad6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/topics/db/models.txt
Expand Up @@ -521,8 +521,11 @@ the intermediate model::
>>> beatles.members.all()
<QuerySet [<Person: Ringo Starr>, <Person: Paul McCartney>]>

You can also use ``add()``, ``create()``, or ``set()`` to create relationships,
as long as you specify ``through_defaults`` for any required fields::
You can also use :meth:`~django.db.models.fields.related.RelatedManager.add`,
:meth:`~django.db.models.fields.related.RelatedManager.create`, or
:meth:`~django.db.models.fields.related.RelatedManager.set` to create
relationships, as long as you specify ``through_defaults`` for any required
fields::

>>> beatles.members.add(john, through_defaults={'date_joined': date(1960, 8, 1)})
>>> beatles.members.create(name="George Harrison", through_defaults={'date_joined': date(1960, 8, 1)})
Expand Down

0 comments on commit 8aedad6

Please sign in to comment.