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

phones : Multiple phone numbers per partner (Contact details)

The lino_xl.lib.phones plugin adds functionality to handle multiple phone numbers, email addresses etc ("contact details") per partner. When this plugin is installed, your application can show a "Contact Details" panel per partner instead of the four fields phone, gsm, email and url.

This is a tested document. The following instructions are used for initialization:

>>> import lino
>>> lino.startup('lino_book.projects.liina.settings.doctests')
>>> from lino.api.doctest import *
>>> from django.db.models import Q

Demo data

>>> rt.show(phones.ContactDetailTypes)
======= ======= =========
 value   name    text
------- ------- ---------
 010     email   E-Mail
 020     gsm     Mobile
 030     phone   Phone
 040     url     Website
 050     fax     Fax
 090     other   Other
======= ======= =========
>>> rt.show(phones.ContactDetails)
=============================== ===================== ======== =============== ==== =========
 Value                           Contact detail type   Remark   Partner         ID   Primary
------------------------------- --------------------- -------- --------------- ---- ---------
 https://www.saffre-rumma.net/   Website                        Rumma & Ko OÜ   1    Yes
 andreas@arens.com               E-Mail                         Arens Andreas   2    Yes
 +32 87123456                    Phone                          Arens Andreas   3    Yes
 annette@arens.com               E-Mail                         Arens Annette   4    Yes
 +32 87123457                    Phone                          Arens Annette   5    Yes
=============================== ===================== ======== =============== ==== =========


class lino_xl.lib.phones.ContactDetailType

The name of field on the ContactDetailsOwner where the value of the primary item of this type is to be mirrored.

class lino_xl.lib.phones.ContactDetailTypes

The list of "built-in" types of contact detail items.

class lino_xl.lib.phones.ContactDetail

Whether this item is the primary contact detail for this type and this owner. Setting this field will automatically uncheck any previously primary items and update the owner's contact detail fields.

class lino_xl.lib.phones.ContactDetailsOwner

Model mixin for the potential owner of contact details.

This mixin may be used even when its plugin (lino_xl.lib.phones) is not installed. For example lino_xl.lib.contacts does this.

class lino_xl.lib.phones.ContactDetails
class lino_xl.lib.phones.ContactDetailsByPartner
class lino_xl.lib.phones.ContactDetailsOwnerChecker

Checks for mismatches between contact details and owner.

  • Field differs from primary item

  • Field is empty but primary item exists

  • Missing primary item

The last message is fixable: for example when a partner has a non-empty phone number but no primary item of type phone, then Lino can simply create that item. This situation is normal when a production site which previously had no lino_xl.lib.phones plugin installed is migrated to a schema with that plugin installed.