django-typed-models
django-typed-models copied to clipboard
signals for derived class have base class as source when cascading
Given this doc-item hierarchy:
class BaseDoc(TypedModel):
...
class BaseDocItem(TypedModel):
doc = models.ForeignKey(BaseDoc)
class MyDoc(BaseDoc):
...
class MyItem(BaseDocItem):
...
and post_delete signal handler for MyItem
then:
item.delete() fires post_delete signal with source=MyItem
but doc.delete() fires post_delete signal with source=BaseDocItem
expected result:
without TypedModel post_delete is always fired with source=MyItem
Interesting. See #1 which could be related.
Could you post the code that connects the signals?
@receiver(post_delete, sender=BaseDocItem) # extra registration
@receiver(post_delete, sender=MyItem)
def handler(sender, instance, **kwa):
...
i am using extra registration line as workaround
I have working post_save signal handler for MyDoc and MyItem.