Signal receivers must accept keyword arguments (**kwargs) when using pre_delete signal in Django

21 Views Asked by At

I am trying to make a destructor-similar signal in django to be called before any children of the class Base are deleted. The reason is that I need to change something on another models's field when this is deleted as part of cleaning up, and I want this to run when for example deleting the instance from Admin.

I have this in my models.py:

@receiver(pre_delete, sender = Base)
def delete_shot_script(sender, instance, **kwargs):
    print("Calling the destructor")
           do_something...

I am getting the error ValueError: Signal receivers must accept keyword arguments (**kwargs), why?

Is the approach valid otherwise?

I have tried adding **kwargs, but the error seems to persist.

0

There are 0 best solutions below