[4.0.x] Refs #33163 -- Corrected example of connection signal handlers in AppConfig.ready().
Backport of 75ee7057e98dd9725fabb98cabe42966fa4c8222 from main
This commit is contained in:
parent
5a61bdbb85
commit
1ab5842760
@ -142,6 +142,7 @@ Now, our ``my_callback`` function will be called each time a request finishes.
|
|||||||
connect signal handlers::
|
connect signal handlers::
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
from django.core.signals import request_finished
|
||||||
|
|
||||||
class MyAppConfig(AppConfig):
|
class MyAppConfig(AppConfig):
|
||||||
...
|
...
|
||||||
@ -150,7 +151,7 @@ Now, our ``my_callback`` function will be called each time a request finishes.
|
|||||||
# Implicitly connect a signal handlers decorated with @receiver.
|
# Implicitly connect a signal handlers decorated with @receiver.
|
||||||
from . import signals
|
from . import signals
|
||||||
# Explicitly connect a signal handler.
|
# Explicitly connect a signal handler.
|
||||||
signals.request_finished.connect(signals.my_callback)
|
request_finished.connect(signals.my_callback)
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user