General overview of Lino LETS

The goal of Lino LETS is

A tested document

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

>>> import lino
>>> lino.startup('lino_lets.projects.letsdemo.settings.doctests')
>>> from lino.api.doctest import *

Show the list of members:

>>> rt.show(users.AllUsers)
... 
============ ===================== ========== =========================================================================== =====================
 First name   e-mail address        Place      offered_products                                                            wanted_products
------------ --------------------- ---------- --------------------------------------------------------------------------- ---------------------
 Anne         anne@example.com      Tallinn    *Buckwheat*
 Argo         argo@example.com      Haapsalu   *Electricity repair work*, *Building repair work*, *Sanitary repair work*
 Fred         fred@example.com      Tallinn    *Bread*, *Buckwheat*
 Henri        henri@example.com     Tallinn    *Electricity repair work*                                                   *Buckwheat*, *Eggs*
 Jaanika      jaanika@example.com   Tallinn
 Katrin       katrin@example.com    Vigala
 Mari         mari@example.com      Tartu      *Buckwheat*                                                                 *Eggs*
 Peter        peter@example.com     Vigala
 Robin        demo@example.com
============ ===================== ========== =========================================================================== =====================

The Products table shows all products in alphabetical order:

>>> rt.show(market.Products)
... 
==== ========================= ========== ========================================================= =======================================
 ID   Designation               Category   Offered by                                                Wanted by
---- ------------------------- ---------- --------------------------------------------------------- ---------------------------------------
 1    Bread                     Food       `Fred <Detail>`__
 2    Buckwheat                 Food       `Anne <Detail>`__, `Fred <Detail>`__, `Mari <Detail>`__   `Henri <Detail>`__
 5    Building repair work      Work       `Argo <Detail>`__
 3    Eggs                      Food                                                                 `Henri <Detail>`__, `Mari <Detail>`__
 6    Electricity repair work   Work       `Argo <Detail>`__, `Henri <Detail>`__
 4    Sanitary repair work      Work       `Argo <Detail>`__
==== ========================= ========== ========================================================= =======================================

The demo project contains two categories:

>>> rt.show(market.Categories)
... 
==== =============
 ID   Designation
---- -------------
 1    Food
 2    Work
==== =============

The Offers table show all offers.

>>> rt.show(market.Offers)
... 
==== ========== ========================= =============
 ID   Provider   Product                   valid until
---- ---------- ------------------------- -------------
 1    Fred       Bread
 2    Fred       Buckwheat
 3    Anne       Buckwheat
 4    Mari       Buckwheat
 5    Henri      Electricity repair work
 6    Argo       Electricity repair work
 7    Argo       Building repair work
 8    Argo       Sanitary repair work
==== ========== ========================= =============

The ActiveProducts table is an example of how to handle customized complex filter conditions. It is a subclass of Products, but adds filter conditions so that only “active” products are shown, i.e. for which there is at least one offer or one demand. It also specifies column_names to show the two virtual fields offered_by and wanted_by.

>>> rt.show(market.ActiveProducts)
... 
========================= ========================================================= =======================================
 Designation               Offered by                                                Wanted by
------------------------- --------------------------------------------------------- ---------------------------------------
 Bread                     `Fred <Detail>`__
 Buckwheat                 `Anne <Detail>`__, `Fred <Detail>`__, `Mari <Detail>`__   `Henri <Detail>`__
 Building repair work      `Argo <Detail>`__
 Eggs                                                                                `Henri <Detail>`__, `Mari <Detail>`__
 Electricity repair work   `Argo <Detail>`__, `Henri <Detail>`__
 Sanitary repair work      `Argo <Detail>`__
========================= ========================================================= =======================================