summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/signals.txt10
-rw-r--r--docs/releases/1.7.txt6
-rw-r--r--docs/topics/auth/customizing.txt13
3 files changed, 27 insertions, 2 deletions
diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt
index 051f1fa915..1abfed8806 100644
--- a/docs/ref/signals.txt
+++ b/docs/ref/signals.txt
@@ -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
--------
diff --git a/docs/releases/1.7.txt b/docs/releases/1.7.txt
index 8c3226ff48..4999fc11a8 100644
--- a/docs/releases/1.7.txt
+++ b/docs/releases/1.7.txt
@@ -425,7 +425,7 @@ Models
* Is it now possible to avoid creating a backward relation for
:class:`~django.db.models.OneToOneField` by setting its
:attr:`~django.db.models.ForeignKey.related_name` to
- `'+'` or ending it with `'+'`.
+ ``'+'`` or ending it with ``'+'``.
* :class:`F expressions <django.db.models.F>` support the power operator
(``**``).
@@ -436,6 +436,10 @@ Signals
* The ``enter`` argument was added to the
:data:`~django.test.signals.setting_changed` signal.
+* The model signals can be now be connected to using a ``str`` of the
+ ``'app_label.ModelName'`` form – just like related fields – to lazily
+ reference their senders.
+
Templates
^^^^^^^^^
diff --git a/docs/topics/auth/customizing.txt b/docs/topics/auth/customizing.txt
index fa6075fac8..7b15a2f8d3 100644
--- a/docs/topics/auth/customizing.txt
+++ b/docs/topics/auth/customizing.txt
@@ -413,6 +413,19 @@ different User model.
class Article(models.Model):
author = models.ForeignKey(settings.AUTH_USER_MODEL)
+ .. versionadded:: 1.7
+
+ When connecting to signals sent by the User model, you should specify the
+ custom model using the :setting:`AUTH_USER_MODEL` setting. For example::
+
+ from django.conf import settings
+ from django.db.models.signals import post_save
+
+ def post_save_receiver(signal, sender, instance, **kwargs):
+ pass
+
+ post_save.connect(post_save_receiver, sender=settings.AUTH_USER_MODEL)
+
Specifying a custom User model
------------------------------