```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)```
--
Ticket URL: <https://code.djangoproject.com/ticket/29440>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> 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)```
New description:
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):`
--
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:1>
* component: Database layer (models, ORM) => Documentation
* stage: Unreviewed => Accepted
Comment:
I believe the documentation should be updated similar to
abe6c5defefc7057e7fb5f47b79643f7b89f7d90.
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:2>
* status: new => assigned
* owner: nobody => Bartosz Grabski
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:3>
* cc: Bartosz Grabski (added)
* owner: Bartosz Grabski => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:4>
* status: new => assigned
* owner: (none) => Jeremy Lainé
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:5>
* has_patch: 0 => 1
Comment:
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.
https://github.com/django/django/pull/9982
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:6>
Comment (by Jeremy Lainé):
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 will open another issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:7>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"741792961815cf4a95c5ce8ab590dfc7700c6153" 74179296]:
{{{
#!CommitTicketReference repository=""
revision="741792961815cf4a95c5ce8ab590dfc7700c6153"
Fixed #29440 -- Doc'd where the bulk argument applies in RelatedManager.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:9>
Comment (by Tim Graham <timograham@…>):
In [changeset:"36c35aba094ac0b27620328bd48099bc971aca20" 36c35aba]:
{{{
#!CommitTicketReference repository=""
revision="36c35aba094ac0b27620328bd48099bc971aca20"
[2.1.x] Fixed #29440 -- Doc'd where the bulk argument applies in
RelatedManager.
Backport of 741792961815cf4a95c5ce8ab590dfc7700c6153 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:10>