20120705

  • Translations FR and one bugfix in lino.modlib.courses.

Configuring User Groups and Profiles

The state field of lino.modlib.tickets.Ticket is now a ChoiceListField. New module lino.modlib.tickets.utils.

Discovered a conceptual problem: both modules lino_xl.lib.cal and lino.modlib.outbox expect a UserGroup named “office”, which lino.apps.pcsw defines in customize_user_groups:

add('office',_("Calendar & Outbox"),'office')

But since the modules don’t define this group themselves, a Lino application cannot use them “out of the box”.

Another problem was to make UserProfiles locally configurable.

It took me almost four hours to solve these two problems.

  • lino.Lino.setup_user_profiles()

  • lino.dd.add_user_group()

  • Changes in lino.utils.choicelists (e.g. lino.utils.choicelists.ChoiceListField._get_choices())

  • lino.modlib.newcomers.models.UsersByNewcomer was defined as follows:

    class UsersByNewcomer(users.Users):
        ...
        filter = models.Q(profile__in=[p for p in UserProfiles.items() if p.integ_level])
    

    This had to change to a dynamic filter because UserProfiles now aren’t yet defined when the models modules are being imported:

    class UsersByNewcomer(users.Users):
        ...
        @classmethod
        def get_request_queryset(self,ar):
            profiles = [p for p in UserProfiles.items() if p.integ_level]
            return super(UsersByNewcomer,self,ar).filter(models.Q(profile__in=profiles))