Welcome | Get started | Dive into Lino | Contribute | Topics | Reference | More

lino.mixins.duplicable

Defines the model mixin Duplicable. "duplicable" [du'plikəblə] means "able to produce a duplicate ['duplikət], ['du:plikeit]".

Classes

Duplicable(*args, **kwargs)

Adds a row action "Duplicate" which duplicates (creates a clone of) the object it was called on.

Duplicate([label])

Duplicate the selected row.

class lino.mixins.duplicable.Duplicate(label=None, **kwargs)

Bases: Action

Duplicate the selected row.

This will call lino.core.model.Model.on_duplicate() on the new object and on related objects.

run_from_ui(ar, **kw)

This actually runs the action.

class lino.mixins.duplicable.Duplicable(*args, **kwargs)

Bases: Model

Adds a row action "Duplicate" which duplicates (creates a clone of) the object it was called on.

Subclasses may override lino.core.model.Model.on_duplicate() to customize the default behaviour, which is to copy all fields except the primary key and all related objects that are duplicable.