:date: 2020-04-25 ======================== Saturday, April 25, 2020 ======================== .. 25.04.2019 02.50-04.45 .. 25.04.2019 11:25-12:15 partner details + misc .. 25.04.2019 12:15-12:35 move municipality field from avanti to courntries .. 26.04.2019 03:55-05:23 support remote field pointing to virtual FK .. 26.04.2019 17:45-18:11 use get_queryset() .. 26.04.2019 19:05-19:45 municipality_choices .. 26.04.2019 22:53-23:16 municipality_choices (Lino doesn't find chooser for remote fields) .. 27.04.2019 04:30-05:52 municipality_choices (Lino doesn't find chooser for remote fields) .. 27.04.2019 10:03-10:26 verbose_name for municipality .. 27.04.2019 10:58- review book tests This weekend I moved the virtual :attr:`municipality ` field from :ref:`avanti` to :mod:`lino_xl.lib.countries` because we will also use it for :ref:`presto`. Also this field is now a virtual ForeignKey field (and no longer a :func:`lino.core.fields.displayfield`). I did this because I want :ref:`presto` to be able to filter calendar entries by the municipality. That is, I wanted, in :class:`cal.AllEntries`, a table parameter "Municipality" that, if set, would show only calendar entries whose :attr:`lino_xl.lib.cal.Entry.project` field points to a :class:`lino_presto.lib.presto.Client` who lives either in that :term:`place` or in a place that is part of it. This change caused a series of internal optimizations. After doing it, I realized that it was not really necessary for :ref:`presto` because I they simply print "service reports" using the :xfile:`service_report.weasy.html ` template. New developer feature : Lino now also understands remote fields that forward to a virtualfield as actor parameters. The application developer must define themselves how to translate this parameter into a queryset filter by providing a custom :meth:`get_request_queryset` method. The virtual municipality field and its chooser is defined on the :class:`lino_xl.lib.countries.CountryCity` mixin. Presto uses it in :mod:`lino_presto.lib.cal`. .. AttributeError: 'VirtualField' object has no attribute 'get_lookup' .. Exception: lino.core.layouts.ParamsLayout on lino_xl.lib.cal.ui.AllEntries has no data element 'project__municipality ('VirtualField' object has no attribute 'blank')' I moved some internal utility functions from one module to another (make_converter, make_remote_field, get_chooser_for_field etc). The caching in check_for_chooser() didn't actually work. .. dt docs/blog/2020/0425.rst >>> from lino import startup >>> startup('lino_presto.projects.presto1.settings.doctests') >>> from lino.api.doctest import * >>> ses = rt.login('robin') Note that Lino's :class:`lino.core.fields.RemoteField` has nothing to do with Django's :attr:`remote_field` of a FK field. >>> fld = rt.models.contacts.Partner._meta.get_field('city') >>> fld.remote_field