Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

groups : user groups

We assume that you have read the end-user documentation page in The groups plugin.

This document contains code snippets (lines starting with >>>) that get tested as part of our development workflow.

>>> import lino
>>> lino.startup('lino_book.projects.noi1e.settings.demo')
>>> from lino.api.doctest import *
>>> from django.db.models import Q

Usage

When you install this plugin, you will probably add a panel “Memberships” (MembershipsByUser) to the detail layout of your lino.modlib.users.UserDetail.

This plugin doesn’t create its own top-level menu but adds its menu commands to the same menu as lino.modlib.system.

>>> dd.plugins.groups.menu_group
'system'

In Lino Noi the verbose name of “Group” is changed to “Team”.

>>> print(dd.plugins.groups.verbose_name)
Teams
>>> show_menu_path(groups.Groups)
Configure --> System --> Teams

Groups

>>> rt.login("robin").show(groups.Groups)
==================== ========= ==================================================================
 Team                 Private   Memberships
-------------------- --------- ------------------------------------------------------------------
 `Developers <…>`__   No        `Jean <…>`__, `Mathieu <…>`__, `Robin Rood <…>`__, **New** **?**
 `Managers <…>`__     Yes       `Luc <…>`__, `Romain Raffault <…>`__, **New** **?**
 `Sales team <…>`__   No        `Marc <…>`__, `Rolf Rompen <…>`__, **New** **?**
==================== ========= ==================================================================

Jean does not see the private group

>>> rt.login("jean").show(groups.Groups)
==================== ========= ===================================================
 Team                 Private   Memberships
-------------------- --------- ---------------------------------------------------
 `Developers <…>`__   No        `Jean <…>`__, `Mathieu <…>`__, `Robin Rood <…>`__
 `Sales team <…>`__   No        `Marc <…>`__, `Rolf Rompen <…>`__
==================== ========= ===================================================

Anonymous doesn’t see any groups:

>>> rt.show(groups.Groups)
No data to display
class lino_xl.lib.groups.Group

Django model representing a user group.

ref

The reference. An optional alphanumeric identifier that, unlike the primary key, is editable.

See lino.mixins.ref.StructuredReferrable.ref

name

The designation in different languages.

user

The owner of the group

private

Whether this group is considered private. See Visibility of comments.

class lino_xl.lib.groups.Groups

Shows all groups.

class lino_xl.lib.groups.Membership

Django model representing a user membership.

user
group
remark