signals.rst 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. .. _signals:
  2. Signals
  3. =======
  4. South offers its own signals, if you want to write code which executes before
  5. or after migrations. They're available from ``south.signals``.
  6. pre_migrate
  7. -----------
  8. Sent just before South starts running migrations for an app.
  9. Provides one argument, ``app``, a string containing the app's label.
  10. post_migrate
  11. ------------
  12. Sent just after South successfully finishes running migrations for an app. Note
  13. that if the migrations fail in the middle of executing, this will not get called.
  14. Provides one argument, ``app``, a string containing the app's label.
  15. ran_migration
  16. ------------
  17. Sent just after South successfully runs a single migration file; can easily be
  18. sent multiple times in one run of South, possibly hundreds of times if you
  19. have hundreds of migrations, and are doing a fresh install.
  20. Provides three arguments, ``app``, a string containing the app's label,
  21. ``migration``, a string containing the name of the migration file without the
  22. file extension, and ``method``, which is either ``"forwards"`` or ``"backwards"``.