Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
votes
: User opinions¶
The lino_xl.lib.votes
plugin adds functionality for managing votes.
Table of contents:
Side note: Code snippets (lines starting with >>>
) in this document get
tested as part of our development workflow. The following
initialization snippet tells you which demo project is being used in
this document.
Overview¶
- vote¶
A database object that expresses the fact that a site user has an opinion or interest about a given votable.
- votable¶
A database object that can receive votes.
The application developer can make the instances of a given database model votable by letting the model inherit from
Votable
and specifying the model inPlugin.votable_model
.
Usage¶
When adding this plugin to your application, you must specify the
lino_xl.lib.votes.Plugin.votable_model
.
Plugin configuration¶
Nothing special.
Votes¶
- class lino_xl.lib.votes.Vote¶
Django model for representing a vote. Inherits from UserAuthored, Created, Workable
- votable¶
The ticket (or other votable) being voted.
- user¶
The user who is voting.
- state¶
The state of this vote. Pointer to
VoteStates
.
- priority¶
My personal priority for this ticket.
- rating¶
How the ticket author rates my help on this ticket.
- remark¶
Why I am interested in this ticket.
- nickname¶
My nickname for this ticket. Optional.
If this is specified, then I get a quicklink to this ticket.
- class lino_xl.lib.votes.Votes¶
Table parameters:
- observed_event¶
There are two class attributes for defining a filter conditions which cannot be removed by the user:
- filter_vote_states¶
A set of vote states to require (i.e. to filter upon). This must resolve using
resolve_states
.
- exclude_vote_states¶
A set of vote states to exclude. This must resolve using
resolve_states
.
- filter_ticket_states¶
A set of ticket states to require (i.e. to filter upon). This must resolve using
resolve_states
.
- class lino_xl.lib.votes.AllVotes¶
Show all votes of all users.
- class lino_xl.lib.votes.MyVotes¶
Show all my votes.
- class lino_xl.lib.votes.VotesByVotable¶
Show the votes about this object.
The state of a vote¶
- class lino_xl.lib.votes.VoteState¶
The state of a vote.
- vote_name¶
Translatable text. How a vote is called when in this state.
- class lino_xl.lib.votes.VoteStates¶
The list of possible states of a vote. This is used as choicelist for the
state
field of a vote.The default implementation defines the following choices:
- author¶
Reserved for the author’s vote. Lino automatically creates an author vote for every author of a ticket (see
get_vote_raters
).
- watching¶
- candidate¶
- assigned¶
- done¶
- rated¶
- cancelled¶
Using votes for rating¶
- class lino_xl.lib.votes.Ratings¶
The list of available ratings.
Vote events¶
- class lino_xl.lib.votes.VoteEvents¶
Welcome messages¶
This plugin adds a welcome message “Your favourites are X, Y, …” that
mentions all votables for which the requesting user has given
a nickname
.
Votables¶
- class lino_xl.lib.votes.Votable¶
This model mixin adds two workflow actions ☆ and ★, which are mutually exclusive.
- create_vote¶
Define your vote about this object.
Button label: ☆
Visible only when you don’t yet have a vote on this object. Clicking it will create a default vote object and show that object in a detail window.
- edit_vote¶
Edit your vote about this object.
Button label: ★