Deleting database objects¶
This section is a topic guide about how to customize behaviour around deleting records.
Unlike Django, Lino has PROTECT as the default on_delete strategy in
ForeignKey fields. If you want CASCADE, then you specify it
explicitly using the
allow_cascaded_delete attribute on the model
whose instances will be deleted.
disable_delete item in
data_record is a "preview"
of whether that row can be deleted or not. The front end may use
this information to disable or enable its delete button.
action will verify again before actually deleting a row.
When Lino analyzes the application's models at startup, it adds a
"disable_delete handler" (
lino.core.ddh) to every model.