4👍
✅
I don’t think you need to hardcode your actions in the model – you can still use signals. But you will need to override delete() to at the very least accept the send_email parameter and – since I don’t think you can pass extra parameters into post_delete() – trigger your own custom signal.
Something like this: (writing from memory, untested!!!)
import django.dispatch
your_signal = django.dispatch.Signal(providing_args=["send_email",])
def your_callback(sender, **kwargs):
print send_email
your_signal.connect(your_callback)
class YourModel(models.Model):
...
def delete(self, send_email=True):
super(YourModel, self).delete()
your_signal.send(sender=self, send_email=send_email)
...
Disclaimer: don’t know if that is the best approach.
Source:stackexchange.com