==========================
Thursday, October 16, 2014
==========================

Continued on :srcref:`docs/tickets/133`
========================================

#.  Feld :class:`"Auszüge" <lino.modlib.excerpts.ExcerptsByProject>` im Reiter
    "Historie" wurde noch nicht automatisch aktualisiert nach einem
    Ausdruck.

#.  Im Reiter "Lebenslauf" einen Link zum letzten Lebenslauf oder zur
    Tabelle aller erstellten Lebensläufe.  --> Außer dass das Feld
    nicht im Reiter "Lebenslauf" ist sondern provisorisch im Reiter
    "Sonstiges".

Die Implementierung des Feldes "Erstellte Lebensläufe" war subtil:

First idea was to add a new field `vfield_name` on
:class:`lino.modlib.excerpts.ExcerptType` and then extend
:func:`lino.modlib.excerpts.set_excerpts_actions` to install a virtual field on
the model for these types.  But that approach would result in layouts
based on database content.  Sounds dangerous and hackerish.

So we finally did it by defining a new choicelist `Shortcuts` and to
add a field `shortcut` in :class:`lino.modlib.excerpts.ExcerptType` which
points to this choicelist.

In :mod:`lino_welfare.modlib.pcsw` we now do::

  excerpts.Shortcuts.add('pcsw.Client', 'cvs_emitted')

And then :func:`lino.modlib.excerpts.set_excerpts_actions` was extended to
define the virtual fields::

  for i in ExcerptShortcuts.items():
      def f(obj, ar):
          try:
              et = ExcerptType.objects.get(shortcut=i.name)
          except DoesNotExist:
              return ''
          qs = Excerpt.objects.filter(owner=obj, excerpt_type=et)
          ...
      dd.inject_field(i.model, i.name, f)


This change causes a :ref:`mustmig` for applications which use
:mod:`lino.modlib.excerpts`.


:cmd:`pm dump2py` was broken
============================

Temporary bugfix in `north` before moving the command to Lino. 

Added a test case::

  $ python setup.py test -s tests.DumpTests