mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #21391 -- Allow model signals to lazily reference their senders.
This commit is contained in:
@@ -22,7 +22,7 @@ Model signals
|
||||
:synopsis: Signals sent by the model system.
|
||||
|
||||
The :mod:`django.db.models.signals` module defines a set of signals sent by the
|
||||
module system.
|
||||
model system.
|
||||
|
||||
.. warning::
|
||||
|
||||
@@ -37,6 +37,14 @@ module system.
|
||||
so if your handler is a local function, it may be garbage collected. To
|
||||
prevent this, pass ``weak=False`` when you call the signal's :meth:`~django.dispatch.Signal.connect`.
|
||||
|
||||
.. versionadded:: 1.7
|
||||
|
||||
Model signals ``sender`` model can be lazily referenced when connecting a
|
||||
receiver by specifying its full application label. For example, an
|
||||
``Answer`` model defined in the ``polls`` application could be referenced
|
||||
as ``'polls.Answer'``. This sort of reference can be quite handy when
|
||||
dealing with circular import dependencies and swappable models.
|
||||
|
||||
pre_init
|
||||
--------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user