Is there a way to see which signals have been set in Django?
Django includes a “signal dispatcher” which helps decoupled applications get notified when actions occur elsewhere in the framework. In a nutshell, signals allow certain senders to notify a set of receivers that some action has taken place.
pre_save. This is sent at the beginning of a model's save() method. Arguments sent with this signal: sender.
Only use signals to avoid introducing circular dependencies. If you have two apps, and one app wants to trigger behaviour in an app it already knows about, don't use signals. The app should just import the function it needs and call it directly.
In the example above, save_profile is our receiver function, User is the sender and post_save is the signal. You can read it as: Everytime when a User instance finalize the execution of its save method, the save_profile function will be executed. If you supress the sender argument like this: post_save.
It's not really exposed in docs but Signal is just a class that contains a list of receivers which are called on event. You can manually check this list:
from django.db.models.signals import * for signal in [pre_save, pre_init, pre_delete, post_save, post_delete, post_init, post_syncdb]: # print a List of connected listeners print signal.receivers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With