#17688: No m2m_changed signal sent to when referenced object is deleted
-------------------------------------+-------------------------------------
     Reporter:  jblaine@…            |                    Owner:
                                     |  jorgecarleitao
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Gary Chen):

 Interested in taking on this change. I'm thinking it'll involve:
 * Undoing [26c4be2ebe] to disable fast_deletes when m2m_changed signals
 are connected
 * Took at look at [https://github.com/django/django/pull/6579] but I'm not
 sure the approach there is correct, the hidden through model is already
 included and cascaded in the collector. We just need to fire the correct
 signal in that case, and we can do so easily by checking
 `model._meta.auto_created`
 
[https://github.com/django/django/blob/a97d6b198eec13a98ef60d7f440528ba82889071/django/db/models/deletion.py#L327
 which is already being done].

 One question is if `model._meta.auto_created` is indeed a determiner for
 if a model is a generated m2m through model--I'm assuming it's already
 being used as such to skip pre/post_delete signals.

 There is a design question I think whether the `m2m_changed` signal should
 only be triggered explicitly via methods on ManyRelatedManager, or any
 changes to the autogenerated m2m model should in fact be captured. I think
 there's precedent with deletes at least, in that cascading deletes trigger
 pre/post_delete signals. So it's not a far stretch that deleted m2m
 relations trigger m2m_changed signals.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/17688#comment:19>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018df1bbf6e2-d64cdf93-c249-46ed-9b4e-2fe2eeb5aea7-000000%40eu-central-1.amazonses.com.

Reply via email to