[Django] #29440: RelatedManager.set() doesn't accept bulk keyword argument for many-to-many relations

8 views
Skip to first unread message

Django

unread,
May 25, 2018, 5:37:24 AM5/25/18
to django-...@googlegroups.com
#29440: RelatedManager.set() doesn't accept bulk keyword argument for many-to-many
relations
-------------------------------------+-------------------------------------
Reporter: Jeremy | Owner: nobody
Lainé |
Type: Bug | Status: new
Component: Database | Version: 2.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 25, 2018, 5:40:49 AM5/25/18
to django-...@googlegroups.com
#29440: RelatedManager.set() doesn't accept bulk keyword argument for many-to-many
relations
-------------------------------------+-------------------------------------
Reporter: Jeremy Lainé | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 2.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Jeremy Lainé:

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>

Django

unread,
May 25, 2018, 9:34:05 AM5/25/18
to django-...@googlegroups.com
#29440: Document that RelatedManager.set() doesn't accept bulk keyword argument for
many-to-many relations
-------------------------------+------------------------------------

Reporter: Jeremy Lainé | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham):

* 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>

Django

unread,
May 26, 2018, 4:37:06 AM5/26/18
to django-...@googlegroups.com
#29440: Document that RelatedManager.set() doesn't accept bulk keyword argument for
many-to-many relations
-------------------------------+-------------------------------------------
Reporter: Jeremy Lainé | Owner: Bartosz Grabski
Type: Bug | Status: assigned

Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-------------------------------------------
Changes (by Bartosz Grabski):

* status: new => assigned
* owner: nobody => Bartosz Grabski


--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:3>

Django

unread,
May 26, 2018, 6:01:46 AM5/26/18
to django-...@googlegroups.com
#29440: Document that RelatedManager.set() doesn't accept bulk keyword argument for
many-to-many relations
-------------------------------+------------------------------------
Reporter: Jeremy Lainé | Owner: (none)
Type: Bug | Status: new

Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Bartosz Grabski):

* cc: Bartosz Grabski (added)
* owner: Bartosz Grabski => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:4>

Django

unread,
May 26, 2018, 6:02:35 AM5/26/18
to django-...@googlegroups.com
#29440: Document that RelatedManager.set() doesn't accept bulk keyword argument for
many-to-many relations
-------------------------------+----------------------------------------
Reporter: Jeremy Lainé | Owner: Jeremy Lainé
Type: Bug | Status: assigned

Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------------------------
Changes (by Jeremy Lainé):

* status: new => assigned

* owner: (none) => Jeremy Lainé


--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:5>

Django

unread,
May 26, 2018, 6:22:35 AM5/26/18
to django-...@googlegroups.com
#29440: Document that RelatedManager.set() doesn't accept bulk keyword argument for
many-to-many relations

-------------------------------+----------------------------------------
Reporter: Jeremy Lainé | Owner: Jeremy Lainé
Type: Bug | Status: assigned
Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------------------------
Changes (by Jeremy Lainé):

* 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>

Django

unread,
May 26, 2018, 6:25:02 AM5/26/18
to django-...@googlegroups.com
#29440: Document that RelatedManager.set() doesn't accept bulk keyword argument for
many-to-many relations

-------------------------------+----------------------------------------
Reporter: Jeremy Lainé | Owner: Jeremy Lainé
Type: Bug | Status: assigned
Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------------------------

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>

Django

unread,
May 31, 2018, 3:44:21 AM5/31/18
to django-...@googlegroups.com
#29440: Document that RelatedManager.set() doesn't accept bulk keyword argument for
many-to-many relations
-------------------------------------+-------------------------------------

Reporter: Jeremy Lainé | Owner: Jeremy
| Lainé
Type: Bug | Status: assigned
Component: Documentation | Version: 2.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Johannes Hoppe):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/29440#comment:8>

Django

unread,
Jun 8, 2018, 4:29:14 PM6/8/18
to django-...@googlegroups.com
#29440: Document that RelatedManager.set() doesn't accept bulk keyword argument for
many-to-many relations
-------------------------------------+-------------------------------------

Reporter: Jeremy Lainé | Owner: Jeremy
| Lainé
Type: Bug | Status: closed
Component: Documentation | Version: 2.0
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* 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>

Django

unread,
Jun 8, 2018, 4:41:05 PM6/8/18
to django-...@googlegroups.com
#29440: Document that RelatedManager.set() doesn't accept bulk keyword argument for
many-to-many relations
-------------------------------------+-------------------------------------

Reporter: Jeremy Lainé | Owner: Jeremy
| Lainé
Type: Bug | Status: closed
Component: Documentation | Version: 2.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

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>

Reply all
Reply to author
Forward
0 new messages