#33505: Inconsistent Behavior with Abstract Models and Signals
-------------------------------------+-------------------------------------
     Reporter:  Ken Weaver           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

 > However, it does still strike me as strange that sender is essentially
 ignored in the example I gave; is that truly intended behavior?

 `sender` is not ignored, see my comment:

 > `pre_save`, `post_save`, `pre_delete`, and `post_delete` signals
 connected to an abstract models will never be send (without custom
 senders) because `save()` and `delete()` methods are not called on
 abstract models.

 So these signals are not send for abstract models by Django itself.
 However, users can send them manually, for example by overwriting `save()`
 in a child model:
 {{{
     def save(
         self, force_insert=False, force_update=False, using=None,
 update_fields=None
     ):
         pre_save.send(sender=Parent, ...)
         super().save(...)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33505#comment:3>
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/068.3cac106e2911720c7c6d61f0f91da830%40djangoproject.com.

Reply via email to