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

Introduction to model mixins

Lino comes with a collection of mixin classes for database models that encapsulate higher-level application concepts.

A model mixin is a class meant to mixed into the list of parent classes when defining a database model. For example lino.mixins.Contactable means “somebody who can be contacted by email in a given language”. Here is how to use this model mixin:

class ContactPerson(dd.Model, Contactable):
    ...

The above ContactPerson model will “automatically” have two fields email and language. These fields are defined on the lino.mixins.Contactable mixin.

Here is a list of some model mixins that that are worth to know:

That should be enough for an introduction, but I can tell you already now that Lino has many mixins. Some more examples:

See also lino.core.model and lino.mixins.