#26678 closed Cleanup/optimization (fixed)
Document that ManyRelatedManager.add()/remove() can take primary keys
Reported by: | Antonin | Owned by: | Tobias Kunze |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | add ManyToMany |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The documentation does not mention that the add method can be called with primary keys instead of model instances:
https://docs.djangoproject.com/en/dev/ref/models/relations/#django.db.models.fields.related.RelatedManager.add
This is only documented in the code:
https://github.com/django/django/blob/master/django/db/models/fields/related_descriptors.py#L984
I will file a PR regarding this issue.
Change History (8)
comment:1 by , 9 years ago
Has patch: | set |
---|---|
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
Version: | 1.9 → master |
comment:2 by , 9 years ago
Patch needs improvement: | unset |
---|
comment:3 by , 9 years ago
Summary: | Precision in the documentation about the add method for ManyToMany fields. → Document that ManyRelatedManager.add()/remove() can take primary keys |
---|
comment:4 by , 9 years ago
Patch needs improvement: | set |
---|
comment:5 by , 6 years ago
Owner: | changed from | to
---|---|
Patch needs improvement: | unset |
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
PR that could be improved based on received feedback about the similar behavior of
remove()
and it's docstring.