lino_xl.lib.outbox.mixins

Model mixins for lino_xl.lib.outbox.

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

Classes

CreateMail([label])

Creates an outbox mail and displays it.

Mailable(*args, **kwargs)

Mixin for models that provide a "Post" button.

MailableType(*args, **kwargs)

Mixin for Models that serve as type of a Mailable.

class lino_xl.lib.outbox.mixins.MailableType(*args, **kwargs)

Bases: lino.core.model.Model

Mixin for Models that serve as type of a Mailable. Concrete examples are cal.EventType, cal.GuestRole, notes.NoteType.

templates_group = None

Should contain a string "<app_label>/<Model>" of the Mailable being typed by this MailableType. Example:

class NoteType(..., MailableType):
    templates_group = 'notes/Note'

class Note(..., Mailable):
    type = dd.ForeignKey(NoteType)
class lino_xl.lib.outbox.mixins.CreateMail(label=None, **kwargs)

Bases: lino.core.actions.Action

Creates an outbox mail and displays it.

get_action_permission(ar, obj, state)

This action is not available:

  • when the user has not email address

  • on an obj whose MailableType is empty or has no MailableType.email_template configured

class lino_xl.lib.outbox.mixins.Mailable(*args, **kwargs)

Bases: lino.core.model.Model

Mixin for models that provide a "Post" button. A Mailable model must also inherit from mixins.Printable or some subclass thereof.

get_mailable_subject()

Return the content of the subject field for the email to be created.