#29447: RelatedManager.set() doesn't pass bulk keyword argument to clear()
-------------------------------------+-------------------------------------
               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          |
-------------------------------------+-------------------------------------
 For reverse many-to-one relations, the `set` method's `bulk` keyword
 argument is passed down to the `add()` and `remove()` methods. It isn't
 however passed down to the `clear()` method:

 
https://github.com/django/django/blob/265506bbc347a6b3fcc6c66ab1a2417b3b7ea57a/django/db/models/fields/related_descriptors.py#L711

 This looks like a bug, as passing bulk=True, clear=True results in the
 following behavior:

 - clear() is invoked in "non-bulk" mode, triggering signals
 - add() is correctly invoked in "bulk" mode, no signals are not triggered

 I spotted this while reading the `related_descriptors.py` code to fix
 #29440.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29447>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.8e66fa8eadc8f20525bd2725913c535d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to