system : Site-wide system settings

The lino.modlib.system plugin defines some system features that are automatically installed with every Lino application.

It especially provides the SiteConfig model.

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

>>> import lino
>>> lino.startup('lino_book.projects.min9.settings')
>>> from lino.api.doctest import *

Editable site parameters

Lino provides a standard method for defining persistent site parameters that are editable by end users (at least for those who have access permission).

class lino.modlib.system.Dashboard

This is your main page.

class lino.modlib.system.SiteConfig

A singleton database object used to store persistent site parameters.

This model has exactly one instance, which is accessible as the settings.SITE.site_config property.

default_build_method

The default build method to use when rendering printable documents.

If this field is empty, Lino uses the value found in lino.core.site.Site.default_build_method.

simulate_today

A constant user-defined date to be substituted as current system date.

This should be empty except in situations such as a posteriori data entry in a prototype.

site_company

The site operator, i.e. the legal person that operates this Lino site.

See How to specify the site operator.

If no plugin named 'contacts' is installed, then this is a dummy field and always contains None.

hide_events_before

If this is not empty, any calendar events before that date are being hidden in certain places.

For example OverdueEvents, EntriesByController, ...

Injected by lino_xl.lib.cal.

class lino.modlib.system.SiteConfigManager

Always return the cached instance which holds the one and only database instance.

This is to avoid the following situation:

  • User 1 opens the Configure ‣ System‣ System Parameters dialog

  • User 2 creates a new Person (which increases next_partner_id)

  • User 1 clicks on Save.

next_partner_id may not get overwritten by its old value when User 1 clicks "Save".

class lino.modlib.system.Lockable

Mixin to add row-level edit locking to any model.

Models with row-level edit locking are not editable in detail view by default. All form fields are disabled. The user must click Edit in order to request an edit lock for that row. This will enable all fields (except those which are disabled for some other reason).

Caveats: locking a row and then navigating away without changing anything will leave the row locked.

class lino.modlib.system.BuildSiteCache

Rebuild the site cache. This action is available on About.

class lino.modlib.system.SiteConfigs

The table used to present the SiteConfig row in a Detail form.

See also lino.core.site.Site.get_site_config().

class lino.modlib.system.BleachChecker

A data checker used to find unbleached html content.

class lino.modlib.system.Genders

Defines the two possible choices "male" and "female" for the gender of a person.

It is used for deciding the salutation (Mr/Mrs) and for its mf() method. So I don't see why we would need a third gender in Lino.

See The Human mixin for examples. See Introduction to choicelists.

class lino.modlib.system.YesNo

A choicelist with two values "Yes" and "No".

Used e.g. to define parameter panel fields for BooleanFields:

foo = dd.YesNo.field(_("Foo"), blank=True)
class lino.modlib.system.ObservedEvent

Base class for choices of "observed event"-style choicelists.

add_filter(self, qs, pv)

Add a filter to the given Django queryset. The given obj must be either a datetime.date object or must have two attributes start_date and end_date. The easiest way is to have it an instance of DateRange or DateRangeValue.

class lino.modlib.system.PeriodEvents

The list of things you can observe on a lino.mixins.periods.DateRange.

class lino.modlib.system.TimeZones

Used by lino.modlib.users.User.time_zone and lino_xl.lib.working.Session.time_zone.

See also USE_TZ.

class lino.modlib.system.DateFormats

Used by lino.modlib.users.User.date_format.