topics : topics and partner interests

The lino_xl.lib.topics plugin adds the notions of "topics" and "interests" of a "partner" in a topic.

This is a tested document. The following instructions are used for initialization:

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

Overview

A topic is something a partner can be interested in. An interest is the fact that a given partner is interested in a given topic.

Users can see a panel "Interests" (InterestsByPartner) in the detail window of a partner.

They can add a row in that panel to specify that this partner is interested in a topic. They can open the panel in a window to delete interests.

A site manager can configure the list of available topics.

>>> show_menu_path(topics.AllTopics)
Configure --> Topics --> Topics

The detail window of a topic has a panel "Interests" (InterestsByTopic) which shows the partners for which this topic is interesting.

A site manager can see a global list of all interests. This might be useful e.g. for exporting the data.

>>> show_menu_path(topics.AllInterests)
Explorer --> Topics --> Interests

Partner

The application developer can decide what a "partner" means for the topics plugin by setting the Plugin.partner_model.

For example in Lino Tera the "partner" who can be interested in a topic is not Partner but Course.

>>> print(dd.plugins.topics.partner_model)
courses.Course

Database models

class lino_xl.lib.topics.Topic

Django model representing a topic.

ref

The reference.

See lino.mixins.ref.StructuredReferrable.ref

name

The designation in different languages.

description_text

Rich text field for a longer multi-line description.

description

Virtual field which includes the formatted structured reference and the description_text.

See lino.mixins.ref.StructuredReferrable.description

topic_group

Deprecated. Don't use.

class lino_xl.lib.topics.Topics
class lino_xl.lib.topics.AllTopics
class lino_xl.lib.topics.TopicsByGroup
class lino_xl.lib.topics.Interest

Django model representing an interest.

owner
topic
remark
class lino_xl.lib.topics.Interests
class lino_xl.lib.topics.InterestsByTopic
class lino_xl.lib.topics.TopicGroup

This model is deprecated. We use the Topic.ref for structuring topics.

class lino_xl.lib.topics.TopicGroups

Currently not used.

Don't read me

Because Topic defines a database field Topic.description the virtual field lino.core.model.Model.description is hidden:

>>> sorted(rt.models.topics.Topic._meta.private_fields, key=lambda f: str(f))
... 
[lino_xl.lib.topics.models.Topic.description,
lino_xl.lib.topics.models.Topic.list_item,
lino_xl.lib.topics.models.Topic.name_column,
lino_xl.lib.topics.models.Topic.navigation_panel,
lino_xl.lib.topics.models.Topic.overview,
lino_xl.lib.topics.models.Topic.workflow_buttons]