Is there a way to see which signals have been set in Django?
相关问题
- Django __str__ returned non-string (type NoneType)
- Django & Amazon SES SMTP. Cannot send email
- Django check user group permissions
- Django restrict pages to certain users
- UnicodeEncodeError with attach_file on EmailMessag
相关文章
- Profiling Django with PyCharm
- Why doesn't Django enforce my unique_together
- MultiValueDictKeyError in Django admin
- Django/Heroku: FATAL: too many connections for rol
- Django is sooo slow? errno 32 broken pipe? dcramer
- how to handle os.system sigkill signal inside pyth
- Django: Replacement for the default ManyToMany Wid
- Upgrading transaction.commit_manually() to Django
I wrote little command that shows all signal listeners: https://gist.github.com/1264102
You can modify it to show signals only.
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:
If you want to list only the connected receivers for a specific signal on a specific model, you can look at
_live_receivers
. For instance, if you want to list the connected post_save hooks for a model named MyModel, you can do:I found this approach in the Django source code by looking for how
has_listeners
works: https://github.com/django/django/blob/3eb679a86956d9eedf24492f0002de002f7180f5/django/dispatch/dispatcher.py#L153There's a django app called django-debug-toolbar which adds a little toolbar at the top of all django served pages providing info related to the backend of the page's rendering, such as how many queries were executed, how much time they each took, etc. It also prints out signals. I don't use signals in my app, so I have never used that feature, but it's there.