Ticket #22748: 22748.diff

File 22748.diff, 902 bytes (added by Tim Graham, 10 years ago)
  • docs/ref/signals.txt

    diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt
    index ac72147..29ba74d 100644
    a b Arguments sent with this signal:  
    491491    The database alias used for synchronization. Defaults to the ``default``
    492492    database.
    493493
    494 For example, ``yourapp/management/__init__.py`` could be written like::
     494For example, you could register a callback in an
     495:class:`~django.apps.AppConfig` like this::
    495496
     497    from django.apps import AppConfig
    496498    from django.db.models.signals import post_migrate
    497     import yourapp.models
    498499
    499500    def my_callback(sender, **kwargs):
    500501        # Your specific logic here
    501502        pass
    502503
    503     post_migrate.connect(my_callback, sender=yourapp.models)
     504    class MyAppConfig(AppConfig):
     505        ...
     506
     507        def ready(self):
     508            post_migrate.connect(my_callback, sender=self)
    504509
    505510post_syncdb
    506511-----------
Back to Top