Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
Signals overview¶
Lino defines a few additional Django signals.
Each signal is an instance of django.dispatch.Signal
stored in
lino.core.signals
.
Startup signals¶
- lino.core.signals.pre_startup¶
- lino.core.signals.post_startup¶
Sent exactly once per process at site startup, just before any application-specific startup actions.
sender: the
lino.core.site.Site
instance
- lino.core.signals.pre_analyze¶
Sent exactly once per process at site startup, just before Lino analyzes the models.
sender: the
lino.core.site.Site
instancemodels_list list of models
- lino.core.signals.post_analyze¶
Sent exactly once per process at site startup, just after Site has finished to analyze the models.
- lino.core.signals.pre_ui_build¶
- lino.core.signals.post_ui_build¶
Database signals¶
- lino.core.signals.database_connected¶
No longer used.
- lino.core.signals.testcase_setup¶
Emitted each time lino.core.utils.TestCase.setUp is called. Lino uses this signal to reset its SiteConfig cache.
It is necessary because (afaics) the Django test runner doesn’t send a ‘connected’ signal when it restores the database to a virgin state before running a new test case.
Row-level signals¶
- lino.core.signals.on_ui_created¶
Sent when a new model instance has been created and saved.
- lino.core.signals.pre_ui_delete¶
Sent just before a model instance is being deleted using the user interface.
request: The HttpRequest object
- lino.core.signals.pre_ui_save¶
Sent before a database object gets saved using the web user interface.
sender the database model
instance the database object which is going to be saved.
ar the action request
- lino.core.signals.on_ui_updated¶
Sent when a database model instance has been modified and saved using the web interface.
A receiver of this signal gets the following keyword parameters:
- Sender:
the database model of the instance which has been updated
- Watcher:
the
ChangeWatcher
object (which contains the model instance and information about the changes)- Request:
the BaseRequest object
- lino.core.signals.pre_merge¶
Sent when a model instance is being merged into another instance.
- lino.core.signals.auto_create¶
The
auto_create
signal is sent whenlookup_or_create
silently created a model instance.Arguments sent with this signal:
sender
: The model instance that has been created.field
: The database fieldknown_values
: The specified known values
- lino.core.signals.pre_remove_child¶
- lino.core.signals.pre_add_child¶
Sent when an MTI child has been added. Arguments to the handler are:
sender : the parent (a database object instance)
request : the HttpRequest which asks to create an MTI child
child : the child model (a class object)
Test-specific signals¶
testcase_setup
Fired inlino.utils.djangotest.TestCase.setUp()
, i.e. at the beginning of each test case.
Runtime signals:
pre_ui_create
pre_ui_update
Utilities:
ChangeWatcher
receiver
: the standard Django receiver decorator
lino.ui.models
also defines a handler which will fire
the database_connected signal
and call the lino.ui.site.clear_site_config()
method on each of the following signals:
testcase_setup
connection_created
post_syncdb