lino_xl.lib.votes.mixins

Model mixins for this plugin.

(This module's source code is available here.)

Classes

Votable(*args, **kwargs)

Base class for models that can be used as lino_xl.lib.votes.Plugin.votable_model.

class lino_xl.lib.votes.mixins.Votable(*args, **kwargs)

Bases: lino.modlib.notify.mixins.ChangeNotifier

Base class for models that can be used as lino_xl.lib.votes.Plugin.votable_model.

get_vote_raters()

Yield or return a list of the users who are allowed to rate the votes on this votable.

Lino automatically (in after_ui_save()) creates an author vote for each of them.

get_favourite(user)

Return the vote of the given user about this votable, or None if no vote exists.

There should be either 0 or 1 vote per user and votable.

set_author_votes()

Verify that every vote rater has a vote.

The raters of a vote are returned by get_vote_raters().

after_ui_create(ar)

Automatically call set_author_votes() after creation.