summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-06-02 11:35:20 -0400
committerTim Graham <timograham@gmail.com>2014-06-02 11:39:23 -0400
commit170255caf43f2d0ae072f0b7a22da90f50bd95b0 (patch)
treee647c76f7ee6fb3daad35c4226c16538ef7068d6
parent724e6008722acb9b69ea3d1749ac8c1125837d03 (diff)
[1.7.x] Fixed #22748 -- Corrected post_migrate usage example.
Thanks Rudolph for the report. Backport of a00efa30d6 from master
-rw-r--r--docs/ref/signals.txt11
1 files changed, 8 insertions, 3 deletions
diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt
index f6a227532c..30a9e9bcdf 100644
--- a/docs/ref/signals.txt
+++ b/docs/ref/signals.txt
@@ -494,16 +494,21 @@ Arguments sent with this signal:
The database alias used for synchronization. Defaults to the ``default``
database.
-For example, ``yourapp/management/__init__.py`` could be written like::
+For example, you could register a callback in an
+:class:`~django.apps.AppConfig` like this::
+ from django.apps import AppConfig
from django.db.models.signals import post_migrate
- import yourapp.models
def my_callback(sender, **kwargs):
# Your specific logic here
pass
- post_migrate.connect(my_callback, sender=yourapp.models)
+ class MyAppConfig(AppConfig):
+ ...
+
+ def ready(self):
+ post_migrate.connect(my_callback, sender=self)
post_syncdb
-----------