Kaydet (Commit) a00efa30 authored tarafından Tim Graham's avatar Tim Graham

Fixed #22748 -- Corrected post_migrate usage example.

Thanks Rudolph for the report.
üst ce993efd
...@@ -491,16 +491,21 @@ Arguments sent with this signal: ...@@ -491,16 +491,21 @@ Arguments sent with this signal:
The database alias used for synchronization. Defaults to the ``default`` The database alias used for synchronization. Defaults to the ``default``
database. 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 from django.db.models.signals import post_migrate
import yourapp.models
def my_callback(sender, **kwargs): def my_callback(sender, **kwargs):
# Your specific logic here # Your specific logic here
pass pass
post_migrate.connect(my_callback, sender=yourapp.models) class MyAppConfig(AppConfig):
...
def ready(self):
post_migrate.connect(my_callback, sender=self)
post_syncdb post_syncdb
----------- -----------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment