Notes

A tested document

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

>>> from lino import startup
>>> startup('lino_welfare.projects.gerd.settings.doctests')
>>> from lino.api.doctest import *
>>> translation.activate("en")

The first meeting

We can use the lino_welfare.modlib.pcsw.Client.get_first_meeting() method for getting the last note about a given client and of given type.

>>> from django.utils.translation import ugettext_lazy as _
>>> flt = dd.str2kw("name", _("First meeting"))
>>> fm = rt.models.notes.NoteType.objects.get(**flt)
>>> ses = rt.login('rolf')
>>> ses.show(notes.NotesByType, fm, column_names="id project")
===== =========================================
 ID    Klient
----- -----------------------------------------
 19    ERNST Berta (125)
 30    EVERTZ Bernd (126)
 41    AUSDEMWALD Alfons (116)
 52    BASTIAENSEN Laurent (117)
 63    COLLARD Charlotte (118)
 74    CHANTRAINE Marc (120*)
 85    DERICUM Daniel (121)
 96    DEMEULENAERE Dorothée (122)
 107   DOBBELSTEIN-DEMEULENAERE Dorothée (123)
===== =========================================

Client 125 has a first meeting, while client 124 doesn’t:

>>> rt.models.pcsw.Client.objects.get(pk=125).get_first_meeting()
Note #19 ('Ereignis/Notiz #19')
>>> rt.models.pcsw.Client.objects.get(pk=124).get_first_meeting()