diff options
| author | Jason Held <jasonsheld@gmail.com> | 2020-06-30 22:54:39 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-07-08 08:26:15 +0200 |
| commit | 3ca2361d70b003019e4135413bdcc800bcbf99e5 (patch) | |
| tree | a43d6ddf421b1af47c58a2ab2ce0f2bbdf35daff /docs | |
| parent | 9141841cca505b9f6b605834dc5adb3e5269fe72 (diff) | |
[3.0.x] Fixed #24816 -- Clarified docs about preventing duplicate signals.
Backport of 639142e24d41c5e5a508cb1280f32fd7ff159cca from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/signals.txt | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/docs/topics/signals.txt b/docs/topics/signals.txt index ee097f9faa..33b6a1b3ae 100644 --- a/docs/topics/signals.txt +++ b/docs/topics/signals.txt @@ -188,7 +188,11 @@ Preventing duplicate signals In some circumstances, the code connecting receivers to signals may run multiple times. This can cause your receiver function to be registered more -than once, and thus called multiple times for a single signal event. +than once, and thus called as many times for a signal event. For example, the +:meth:`~django.apps.AppConfig.ready` method may be executed more than once +during testing. More generally, this occurs everywhere your project imports the +module where you define the signals, because signal registration runs as many +times as it is imported. If this behavior is problematic (such as when using signals to send an email whenever a model is saved), pass a unique identifier as |
