I read the django docs
about signals
and wrote this piece of code for my model Car
:
@receiver(request_finished)
def signal_callback(sender, **kwargs):
print 'Save Signal received'
@receiver(post_save, sender=Car)
def signal_handler(sender, **kwargs):
pass
request_finished(signal_callback, sender=car, dispatch_url="Unique save id")
But the problem is, that when I fire up my server, and just open up the admin, I get a lot of 'Save Signal received'
in my terminal. What I am wondering about is I have restricted the signal_handler
to post_save
only. But still, without even saving anything, the message shows up a lot of times. I dont understand this.
Note : I will be honest. I understood parts of it, not everything from the documentation.