Fixed #11398 - Added a pre_syncdb signal

This commit is contained in:
Donald Stufft 2013-05-17 18:18:35 -04:00
parent 11b06532f7
commit 3de1288042
8 changed files with 158 additions and 2 deletions

View file

@ -360,6 +360,53 @@ Management signals
Signals sent by :doc:`django-admin </ref/django-admin>`.
pre_syncdb
----------
.. data:: django.db.models.signals.pre_syncdb
:module:
Sent by the :djadmin:`syncdb` command before it starts to install an
application.
Any handlers that listen to this signal need to be written in a particular
place: a ``management`` module in one of your :setting:`INSTALLED_APPS`. If
handlers are registered anywhere else they may not be loaded by
:djadmin:`syncdb`.
Arguments sent with this signal:
``sender``
The ``models`` module that was just installed. That is, if
:djadmin:`syncdb` just installed an app called ``"foo.bar.myapp"``,
``sender`` will be the ``foo.bar.myapp.models`` module.
``app``
Same as ``sender``.
``create_models``
A list of the model classes from any app which :djadmin:`syncdb` plans to
create.
``verbosity``
Indicates how much information manage.py is printing on screen. See
the :djadminopt:`--verbosity` flag for details.
Functions which listen for :data:`pre_syncdb` should adjust what they
output to the screen based on the value of this argument.
``interactive``
If ``interactive`` is ``True``, it's safe to prompt the user to input
things on the command line. If ``interactive`` is ``False``, functions
which listen for this signal should not try to prompt for anything.
For example, the :mod:`django.contrib.auth` app only prompts to create a
superuser when ``interactive`` is ``True``.
``db``
The alias of database on which a command will operate.
post_syncdb
-----------