lino.mixins.duplicable

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

(This module's source code is available here.)

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, **kw)

Bases: lino.core.actions.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: lino.core.model.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.