Thursday, October 16, 2014¶
Continued on docs/tickets/133¶
Feld
"Auszüge"
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
lino.modlib.excerpts.ExcerptType
and then extend
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 lino.modlib.excerpts.ExcerptType
which
points to this choicelist.
In lino_welfare.modlib.pcsw
we now do:
excerpts.Shortcuts.add('pcsw.Client', 'cvs_emitted')
And then 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 Change in database structure for applications which use
lino.modlib.excerpts
.
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