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

topics : topics and tags

The lino_xl.lib.topics plugin adds the notions of “topics” and “tags”. Optionally it can also manage “partners” who are “interested” in a topic.

Lines starting with >>> in this document are code snippets that get tested as part of our development workflow.

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

Overview

A topic is something a partner can be interested in. A tag is the fact that a given database row has to do with a given topic. 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

Partner

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

topics.partner_model

The database model that represents the people who can be interested in a topic. If this is None, interest management is deactivated.

For example in Lino Noi the “partners” who can be interested in a topic are the site users.

>>> print(dd.plugins.topics.partner_model)
users.User

The detail window of a topic has a panel “Interests” (InterestsByTopic) which shows the users 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

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.Tag

Django model used to represent a tag.

owner
topic
class lino_xl.lib.topics.Interest

Django model used to represent an interest.

partner
topic
remark
class lino_xl.lib.topics.Interests
class lino_xl.lib.topics.InterestsByTopic

Model mixins

class lino_xl.lib.topics.Taggable

Adds an add_tag field.

add_tag

A virtual field that lets the user select a topic to tag this database row with.

User roles

class lino_xl.lib.topics.TopicsUser

User role required to see the topics plugin.

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.full_page,
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]