Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

lino.core.ddh

Defines the DisableDeleteHandler class.

See Customize delete behaviour.

Classes

DisableDeleteHandler(model)

A helper object used to find out whether a known object can be deleted or not.

class lino.core.ddh.DisableDeleteHandler(model)

Bases: object

A helper object used to find out whether a known object can be deleted or not.

Lino installs an instance of this on each model in an attribute _lino_ddh during kernel startup.

fklist

A list of tuples (model, fk), one item for each FK field in the application which points to this model.

model

The owning model (i.e. m._lino_ddh.model is m is True for every model)

disable_delete_on_object(obj, ignore_models={})

Return a veto message that explains why this object cannot be deleted. Return None if there is no veto.

If ignore_model (a set of model class objects) is specified, do not check for vetos on ForeignKey fields defined on one of these models.