Monday, December 19, 2016

During the weekend I worked on #1307 (register new users).

Online registration

In admin_main_base.html, the sentence “You will now probably want to log in using the Log in button in the upper right corner” is now extended by an “Or _register_ as a new user.”

This action link was a challenge because we don’t simply want an action with a dialog window because we don’t want to redefine every field. It is actually just a customized insert_layout.

To solve this, I added a new class method get_insert_action() which I override in lino.modlib.users.desktop.RegisterUsers.

Another question was: how to handle the fact that anonymous users are -at least until now- readonly and therefore have no permission to insert records into the database. Current answer: The new online Online registration feature is available only on sites whose AnonymousUser has readonly=False (which is currently done only in

>>> from lino import startup
>>> startup('')
>>> from lino.api.doctest import *
>>> rt.modules.users.RegisterNewUser.editable
>>> rt.modules.users.RegisterUsers.update_action
<BoundAction(users.RegisterUsers, <SaveRow grid_put>)>


Workflow for managing new users

I added a workflow for managing users. System administrators now can “activate”, “deactivate” or “reset” users. They have a list of new users to be activated. Activating a user requires the user type to be set. Currently there is no way to define a default user type.

Two new database fields User.verification_code and User.user_state. A new choicelist lino.modlib.users.choicelists.UserStates.

Duplicate welcome messages

I observed #1309 which causes welcome messages to be duplicated. The Site object is being initialized twice, and each time the whole startup process is being called:

$ go min1
$ runserver
20161219 do_site_startup() <lino_book.projects.min1.settings.demo.Site object at 0x7fbb52272a90>
20161219 do_site_startup() done
20161219 do_site_startup() <lino_book.projects.min1.settings.demo.Site object at 0x7f7a2483cad0>
20161219 do_site_startup() done
Performing system checks...

System check identified no issues (0 silenced).
December 18, 2016 - 06:02:35
Django version 1.9.11, using settings 'lino_book.projects.min1.settings.demo'
Starting development server at
Quit the server with CONTROL-C.

Explanation: the reason was not the double import (which is just a traditional and well documented Django oddness), the reason was a bug in the code which collects welcome message handlers for tables having welcome_message_when_count set. If a site has more than one such tables, then the last of them was being called once for each of them. I saw a double message “You have 8 items in New user applications”, the first one should have been “You have 7 items in Tickets to triage”.


  • I started using a file for lino.modlib.users (which required to define that module for all users plugins).

  • Now that lino.modlib.users has an isolated desktop design, the difference between rt.actors and rt.models becomes important.

    UndefinedError: ‘module object’ has no attribute ‘RegisterUsers’

  • I removed the tinymce and clocking plugins from Lino Care.

  • The lino_xl.lib.countries.models.Countries table should not be visible for simple users in Lino Care. I changed its required roles from ContactsUser to ContactsStaff.

Changed logging behaviour

I slightly changed some details of the logging behaviour:

Unsaved Évènement 1 (14.12.2021) conflicts with …

Unsaved Évènement 1 (14.12.2021) conflicts with Évènement #29650 5 (05.08.2016 09:00), Évènement #29653 8 (16.09.2016 09:00), Évènement #29654 9 (30.09.2016 09:00), Évènement #29655 10 (14.10.2016 09:00), Évènement #29657 12 (18.11.2016 09:00), Évènement #29658 13 (02.12.2016 09:00).