Uploads with expiration date management

The lino_xl.lib.uploads plugin extends lino.modlib.uploads by adding "expiration date management" for uploads. This is used by social agents ("coaches") to manage certain documents about their "clients". For example the coach might want to get a reminder when the driving license of one of their clients is going to expire. This plugin requires the lino_xl.lib.clients plugin.

A tested document

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

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

Although this plugin requires the lino_xl.lib.clients plugin, it does not declare this dependency because making it automatic would cause changes in the menu item ordering in Lino Welfare.

The plugin has two custom settings:

>>> dd.plugins.uploads.expiring_start
>>> dd.plugins.uploads.expiring_end

These are the default values for the MyExpiringUploads table

>>> dd.plugins.uploads.needs_plugins
>>> rt.login(dd.plugins.clients.demo_coach).show("uploads.MyExpiringUploads")
==================== ================== ================== ============= ============ ============= ========
 Client               Upload type        Description        Uploaded by   Valid from   Valid until   Needed
-------------------- ------------------ ------------------ ------------- ------------ ------------- --------
 ABAD Aábdeen (114)   Residence permit   Residence permit   nathalie                   10/02/2018    Yes
 ABAD Aábdeen (114)   Work permit        Work permit        nathalie                   10/02/2018    Yes
==================== ================== ================== ============= ============ ============= ========
>>> dd.plugins.clients.demo_coach

Extended uploads

class lino_xl.lib.uploads.Upload

Extends lino.modlib.uploads.Upload by adding some fields.


Date until which the original document is valid.


Whether the responsible user should be reminded when validity of this upload reaches its end.

My expiring upload files

When you want Lino to remind you when some important document (e.g. a driving licence) is going to expire, then you should store the document's expiry date in the Upload.end_date field and check the Upload.needed field.

class lino_xl.lib.uploads.MyExpiringUploads

Shows the upload files that are marked as Upload.needed and whose Upload.end_date is within a given period.