diff options
| author | Simon Charette <charette.s@gmail.com> | 2016-05-13 11:58:54 -0400 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2016-05-15 19:51:15 -0400 |
| commit | f937c9ec975ebd719f0c22e5d1d5f5fb87ff1edd (patch) | |
| tree | c3af8fe0e962e6ec07ba01cac9cd76019230c41e /docs | |
| parent | e475e849703d937e158e75e7a6d9cb99090857f6 (diff) | |
Fixed #24100 -- Made the migration signals dispatch its plan and apps.
Thanks Markus for your contribution and Tim for your review.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/signals.txt | 34 | ||||
| -rw-r--r-- | docs/releases/1.10.txt | 4 |
2 files changed, 38 insertions, 0 deletions
diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt index b7371a1ed0..a3fad2d6ea 100644 --- a/docs/ref/signals.txt +++ b/docs/ref/signals.txt @@ -406,6 +406,23 @@ Arguments sent with this signal: ``using`` The alias of database on which a command will operate. +``plan`` + .. versionadded:: 1.10 + + The migration plan that is going to be used for the migration run. While + the plan is not public API, this allows for the rare cases when it is + necessary to know the plan. A plan is a list of two-tuples with the first + item being the instance of a migration class and the second item showing + if the migration was rolled back (``True``) or applied (``False``). + +``apps`` + .. versionadded:: 1.10 + + An instance of :data:`Apps <django.apps>` containing the state of the + project before the migration run. It should be used instead of the global + :attr:`apps <django.apps.apps>` registry to retrieve the models you + want to perform operations on. + ``post_migrate`` ---------------- @@ -448,6 +465,23 @@ Arguments sent with this signal: The database alias used for synchronization. Defaults to the ``default`` database. +``plan`` + .. versionadded:: 1.10 + + The migration plan that was used for the migration run. While the plan is + not public API, this allows for the rare cases when it is necessary to + know the plan. A plan is a list of two-tuples with the first item being + the instance of a migration class and the second item showing if the + migration was rolled back (``True``) or applied (``False``). + +``apps`` + .. versionadded:: 1.10 + + An instance of :data:`Apps <django.apps.apps>` containing the state of the + project after the migration run. It should be used instead of the global + :attr:`apps <django.apps.apps>` registry to retrieve the models you + want to perform operations on. + For example, you could register a callback in an :class:`~django.apps.AppConfig` like this:: diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index 0463a284b3..9e24225173 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -368,6 +368,10 @@ Migrations migration history. If they find some unapplied dependencies of an applied migration, ``InconsistentMigrationHistory`` is raised. +* The :func:`~django.db.models.signals.pre_migrate` and + :func:`~django.db.models.signals.post_migrate` signals now dispatch their + migration ``plan`` and ``apps``. + Models ~~~~~~ |
