#29440 closed Bug (fixed)
Document that RelatedManager.set() doesn't accept bulk keyword argument for many-to-many relations
Reported by: | Jeremy Lainé | Owned by: | Jeremy Lainé |
---|---|---|---|
Component: | Documentation | Version: | 2.0 |
Severity: | Normal | Keywords: | |
Cc: | Bartosz Grabski | Triage Stage: | Ready for checkin |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Since Django 2.0, trying to pass bulk=True to a many-to-many RelatedManager results in an error:
TypeError: set() got an unexpected keyword argument 'bulk'
The documentation however still states that the "bulk" argument exists, so I'm not sure whether the documentation or the code is wrong.
Looking at the django code, the set() method for reverse many-to-one, and forward many-to-many relations don't have the same signature.
In create_reverse_many_to_one_manager
:
def set(self, objs, *, bulk=True, clear=False):
In create_forward_many_to_many_manager
:
def set(self, objs, *, clear=False):
Change History (10)
comment:1 by , 7 years ago
Description: | modified (diff) |
---|
comment:2 by , 7 years ago
Component: | Database layer (models, ORM) → Documentation |
---|---|
Summary: | RelatedManager.set() doesn't accept bulk keyword argument for many-to-many relations → Document that RelatedManager.set() doesn't accept bulk keyword argument for many-to-many relations |
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 6 years ago
Cc: | added |
---|---|
Owner: | removed |
Status: | assigned → new |
comment:5 by , 6 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
comment:6 by , 6 years ago
Has patch: | set |
---|
I have add a PR, which tries to make the "bulk" argument more consistently documented:
- the signatures for clear() and remove() did not reference "bulk" at all
- I added a note in clear(), remove() and set() to the effect that the "bulk" argument does not exist.
comment:7 by , 6 years ago
In the process, I discovered that for one-to-many relations, the "bulk" argument is correctly passed down to add() and remove(), but not to clear(). This looks like a bug, I have opened issue #29447.
comment:8 by , 6 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I believe the documentation should be updated similar to abe6c5defefc7057e7fb5f47b79643f7b89f7d90.