pre_save signal on Inherited Model?

168 views
Skip to first unread message

Leo Hillman

unread,
Aug 19, 2014, 8:48:07 PM8/19/14
to django-d...@googlegroups.com
I just wanted to write a preliminary post about this before gathering a little more data. When extending a non-abstract model (Python inheritance) it seems to me that a pre_delete signal registered to the parent model is fired when an inherited model is deleted—which would be expected. A pre_save signal registered to the parent model, however, does not seem to be firing when saving the inherited model. I am not sure if this is desired behavior, but it is slightly confusing.

— pre_delete registered on parent model: fired
— pre_save registered on parent model: not fired

I came upon this case when extending the djcelery PeriodicTask object. When creating an instance of an inheriting model, the pre_save signal was not sent, but the pre_delete signal did seem to be sent.

Any thoughts? I can get around this by manually registering the inheriting model.

aryeh

Elena Williams

unread,
Aug 19, 2014, 11:56:27 PM8/19/14
to django-d...@googlegroups.com
Hi Leo,

This is the django-developers mailing list for discussing the development of Django itself. 

For questions about using Django or Django-based applications, please instead post your question to the django-users mailing list: http://groups.google.com/d/forum/django-users

All the best,
Elena

Florian Apolloner

unread,
Aug 20, 2014, 3:29:54 AM8/20/14
to django-d...@googlegroups.com
Hi Leo,


On Wednesday, August 20, 2014 2:48:07 AM UTC+2, Leo Hillman wrote:
— pre_delete registered on parent model: fired
— pre_save registered on parent model: not fired

That sounds inconsistent at least. Can you open a ticket for that?

Cheers,
Florian  

charettes

unread,
Aug 20, 2014, 12:09:53 PM8/20/14
to django-d...@googlegroups.com
This might be related to #9318.
Reply all
Reply to author
Forward
0 new messages