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

Calendar in Lino Tera

This document describes the lino_tera.lib.cal plugin which extends lino_xl.lib.cal for Tera.

This page is a tested document and the following instructions are used for initialization:

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

The calendar summary view

Note that the months are listed in reverse chronological order while the days within a month in normal order.

>>> obj = rt.models.courses.Course.objects.order_by('id').first()
>>> rt.show(cal.EntriesByController, obj)
March 2015: *Tue 10.*☑
February 2015: *Tue 24.*☑ *Tue 10.*☑
January 2015: *Tue 27.*☉ *Tue 13.*☑
Suggested : 0 ,  Scheduled : 0 ,  Took place : 4 ,  Missed : 1 ,  Called off : 0

Missed calendar entries

In Lino Tera we introduce a new calendar entry state "missed" for entries where the guest missed the appointment without a valid reason. A missed appointment may get invoiced while a cancelled appointment not.

Changed the symbol for a "Cancelled" calendar entry from ☉ to ⚕. Because the symbol ☉ (a sun) is used for "Missed". The sun reminds a day on the beach while the ⚕ reminds a drugstore.

>>> rt.show(cal.EntryStates)
======= ============ ============ ============= ============= ======== ============= =========
 value   name         text         Button text   Fill guests   Stable   Transparent   No auto
------- ------------ ------------ ------------- ------------- -------- ------------- ---------
 10      suggested    Suggested    ?             Yes           No       No            No
 20      draft        Scheduled    ☐             Yes           No       No            No
 50      took_place   Took place   ☑             No            Yes      No            No
 60      missed       Missed       ☉             No            Yes      No            Yes
 70      cancelled    Called off   ⚕             No            Yes      Yes           Yes
======= ============ ============ ============= ============= ======== ============= =========
>>> rt.show(cal.EntryStates, language="de")
====== ============ =============== ============= ================= ======== =================== =========
 Wert   name         Text            Button text   Gäste ausfüllen   Stabil   nicht blockierend   No auto
------ ------------ --------------- ------------- ----------------- -------- ------------------- ---------
 10     suggested    Vorschlag       ?             Ja                Nein     Nein                Nein
 20     draft        Geplant         ☐             Ja                Nein     Nein                Nein
 50     took_place   Stattgefunden   ☑             Nein              Ja       Nein                Nein
 60     missed       Verpasst        ☉             Nein              Ja       Nein                Ja
 70     cancelled    Abgesagt        ⚕             Nein              Ja       Ja                  Ja
====== ============ =============== ============= ================= ======== =================== =========

Lino Tera uses the EntryState.guest_state attribute.

>>> rt.show(cal.EntryStates, column_names='name text guest_state')
============ ============ =============
 name         text         Guest state
------------ ------------ -------------
 suggested    Suggested
 draft        Scheduled
 took_place   Took place   Present
 missed       Missed       Missing
 cancelled    Called off   Excused
============ ============ =============

Guest workflow

>>> rt.show(cal.GuestStates, language="de")
====== =========== ============== ============== =============
 Wert   name        Nachträglich   Text           Button text
------ ----------- -------------- -------------- -------------
 10     invited     Nein           Eingeladen     ?
 40     present     Ja             Anwesend       ☑
 50     missing     Ja             Fehlt          ☉
 60     excused     Nein           Entschuldigt   ⚕
 90     cancelled   Nein           Storniert      ☒
====== =========== ============== ============== =============
>>> show_workflow(cal.GuestStates.workflow_actions, language="de")
============= ============== ============== ============== =========================
 Action name   Verbose name   Help text      Target state   Required states
------------- -------------- -------------- -------------- -------------------------
 wf1           ☑              Anwesend       Anwesend       invited
 wf2           ☉              Fehlt          Fehlt          invited
 wf3           ⚕              Entschuldigt   Entschuldigt   invited
 wf4           ?              Eingeladen     Eingeladen     missing present excused
============= ============== ============== ============== =========================

Calendar entry types

>>> rt.show(cal.EventTypes)
... 
=========== ======================== ================== ======================== ================ ============= ===================== =================
 Reference   Designation              Designation (de)   Designation (fr)         Planner column   Appointment   Automatic presences   Locks all rooms
----------- ------------------------ ------------------ ------------------------ ---------------- ------------- --------------------- -----------------
             Absences                 Abwesenheiten      Absences                 External         Yes           No                    No
             Group meeting            Gruppengespräch    Group meeting                             Yes           No                    No
             Holidays                 Feiertage          Jours fériés             External         No            No                    Yes
             Individual appointment   Einzelgespräch     Individual appointment                    Yes           Yes                   No
             Internal                 Intern             Interne                  Internal         No            No                    No
             Meeting                  Versammlung        Réunion                  External         Yes           No                    No
=========== ======================== ================== ======================== ================ ============= ===================== =================

Daily planner

>>> rt.show(calview.DailySlave)
============ ================================================================================================================================================================================================================================================================================================================================================================================================================================================================ ==========
 Time range   External                                                                                                                                                                                                                                                                                                                                                                                                                                                         Internal
------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------
 *All day*    <em><div style="overflow: hidden; height: 1.2em;padding: 0 5px" pk="354"><span CLASS="dot" style="overflow: hidden; background-color: Blue; color: white; "> </span><span> ☉ romain Absent for private reasons</span></div></em><em><div style="overflow: hidden; height: 1.2em;padding: 0 5px" pk="355"><span CLASS="dot" style="overflow: hidden; background-color: Blue; color: white; "> </span><span> ⚕ rolf Absent for private reasons</span></div></em>
 *AM*         <em><div style="overflow: hidden; height: 1.2em;padding: 0 5px" pk="324"><span CLASS="dot" style="overflow: hidden; background-color: Blue; color: white; "> </span><span>08:30 ☑ romain Réunion</span></div></em>
 *PM*
============ ================================================================================================================================================================================================================================================================================================================================================================================================================================================================ ==========

When you are logged in, the calendar entries are clickable:

>>> rt.login("robin").show(calview.DailySlave, max_width=60)  
+------------+--------------------------------------------------------------+----------+
| Time range | External                                                     | Internal |
+============+==============================================================+==========+
| *All day*  | <a href="Detail"><div style="overflow: hidden; height:       |          |
|            | 1.2em;padding: 0 5px" pk="354"><span CLASS="dot"             |          |
|            | style="overflow: hidden; background-color: Blue; color:      |          |
|            | white; "> </span><span> ☉ romain Absent for private          |          |
|            | reasons</span></div></a><a href="Detail"><div                |          |
|            | style="overflow: hidden; height: 1.2em;padding: 0 5px"       |          |
|            | pk="355"><span CLASS="dot" style="overflow: hidden;          |          |
|            | background-color: Blue; color: white; "> </span><span> ⚕     |          |
|            | rolf Absent for private reasons</span></div></a>             |          |
+------------+--------------------------------------------------------------+----------+
| *AM*       | <a href="Detail"><div style="overflow: hidden; height:       |          |
|            | 1.2em;padding: 0 5px" pk="324"><span CLASS="dot"             |          |
|            | style="overflow: hidden; background-color: Blue; color:      |          |
|            | white; "> </span><span>08:30 ☑ romain                        |          |
|            | Réunion</span></div></a>                                     |          |
+------------+--------------------------------------------------------------+----------+
| *PM*       |                                                              |          |
+------------+--------------------------------------------------------------+----------+

My appointments

The My appointments table also shows in the dashboard when it has no data to display.

>>> show_dashboard("elmar", ignore_links=False)
... 
Quick links: [My settings](My settings "Edit your user preferences.") | [Calendar](Detail "Open a detail
window on records of calview.") | [New note](New "Insert a new Note.") | [My
Notes](My Notes)

Hi, Elmar!

Recent birthdays: 05-22 **Laura Laschet** (36)

This is a Lino demo site. Try also the other [demo sites](http://lino-
framework.org/demos.html). Your feedback is welcome to [users@lino-
framework.org](mailto:users@lino-framework.org) or directly to the person who
invited you. **We are running with simulated date set to Saturday, 23 May
2015.**

## My appointments **New** [⏏](My appointments "Show this table in own
window")

No data to display

## Saturday, 23 May 2015 [⏏](None "Show this table in own window")

============
===...===
========== Time range External Internal \------------
---...---
---------- *All day* [ ☉ romain Absent for private reasons](Detail)[ ⚕ rolf
Absent for private reasons](Detail) *AM* [ 08:30 ☑ romain Réunion](Detail)
*PM* ============
===...===
==========
class lino_tera.lib.cal.Event
amount

The amount perceived during this appointment.