Opened 7 years ago
Last modified 7 years ago
#28514 closed Cleanup/optimization
Clarify docs regarding idempotence of RelatedManager.add() — at Version 1
Reported by: | Дилян Палаузов | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
At https://docs.djangoproject.com/en/1.11/topics/db/examples/many_to_many/ it's written:
>> a2.publications.add(p3) > > Adding a second time is OK: > >> a2.publications.add(p3)
Please rephrase it to "Adding a second time is OK, it doesn't duplicate the relation".
At https://docs.djangoproject.com/en/1.11/ref/models/relations/ it's written:
add(*objs, bulk=True) Adds the specified model objects to the related object set.
Please amend: "Inserting existing relations this way does not cause problems."
The purpose of the changes is to make clear, that add()
is idempotent and it is not necessary first to read the data from the database, join with the new values and eventually write the resulting set back.
Change History (1)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|---|
Easy pickings: | set |
Summary: | Documentating idempotence of Many2ManyField.add() → Clarify docs regarding idempotence of RelatedManager.add() |
Triage Stage: | Unreviewed → Accepted |