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

lino.modlib.changes.models

Database models for this plugin.

It defines the Change model. It also adds a menu entry to the Explorer menu.

Functions

log_change(type, request, master, obj[, ...])

on_add_child([sender, request, child])

on_delete([sender, request])

Calls log_change() with ChangeTypes.delete.

on_merge([sender, request])

on_remove_child([sender, request, child])

on_ui_created([sender, request])

To be called when a new instance has actually been created and saved.

on_update([sender, watcher, request])

Log a Change if there is a change_watcher_spec.

Classes

Change(*args, **kwargs)

A registered change in the database.

ChangeTypes(*args, **kw)

The list of possible choices for the type field of a Change.

Changes(*args, **kw)

The default table for Change.

ChangesByMaster(*args, **kw)

Slave Table showing the changes related to the current object, including those applied to "child" objects.

ChangesByObject(*args, **kw)

Slave Table showing the direct changes related to the current object.

class lino.modlib.changes.models.ChangeTypes(*args, **kw)

Bases: ChoiceList

The list of possible choices for the type field of a Change.

class lino.modlib.changes.models.Change(*args, **kwargs)

Bases: UserAuthored

A registered change in the database.

Each database change of a watched object will generate one Change record.

master

The database object which acts as "master".

object

The database object which has been modified.

class lino.modlib.changes.models.Changes(*args, **kw)

Bases: Table

The default table for Change.

model

alias of Change

class lino.modlib.changes.models.ChangesByObject(*args, **kw)

Bases: Changes

Slave Table showing the direct changes related to the current object.

master

alias of ContentType

model

alias of Change

class lino.modlib.changes.models.ChangesByMaster(*args, **kw)

Bases: Changes

Slave Table showing the changes related to the current object, including those applied to "child" objects.

master

alias of ContentType

model

alias of Change

lino.modlib.changes.models.on_update(sender=None, watcher=None, request=None, **kw)

Log a Change if there is a change_watcher_spec. watcher is a lino.core.diff.ChangeWatcher instance.

lino.modlib.changes.models.on_delete(sender=None, request=None, **kw)

Calls log_change() with ChangeTypes.delete.

Note that you must call this before actually deleting the object, otherwise mysql (not sqlite) says ERROR: (1048, "Column 'object_id' cannot be null")

lino.modlib.changes.models.on_ui_created(sender=None, request=None, **kw)

To be called when a new instance has actually been created and saved.

lino.modlib.changes.models.on_merge(sender=None, request=None, **kw)