Refs #9475 -- Linked through_default docs to related managers methods.

This commit is contained in:
Simon Charette 2020-10-22 04:08:35 -04:00 committed by GitHub
parent 509d9da26f
commit 284bde3fbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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)})