assembl.models.votes module¶
Models for voting on ideas
-
class
assembl.models.votes.
AbstractIdeaVote
(**kwargs)[source]¶ Bases:
assembl.lib.history_mixin.HistoryMixinWithOrigin
,assembl.models.DiscussionBoundBase
-
copy
(tombstone=None, db=None, **kwargs)[source]¶ Clone object, optionally as tombstone (aka snapshot) reuse base_id. Redefine in subclasses to define arguments
-
classmethod
get_discussion_conditions
(discussion_id, alias_maker=None)[source]¶ Returns a list of SQLA expressions that constrain a query on this class to a given discussion.
-
live
¶ The live version of this object, if any.
-
populate_from_context
(context)[source]¶ If object created in this context, populate some relations from that context.
This is the magic fallback, ideally define the relationships you want populated explicitly in subclasses of this.
-
classmethod
restrict_to_owners_condition
(query, user_id, alias=None, alias_maker=None)[source]¶ filter query according to object owners
-
classmethod
special_quad_patterns
(alias_maker, discussion_id)[source]¶ Returns a list of quad map patterns for RDF mapping, beyond those defined by introspection.
Important: If defined somewhere, override in subclasses to avoid inheritance.
-
unique_query
()[source]¶ returns a couple (query, usable), with a sqla query for conflicting similar objects. usable is true if the query has to be enforced; sometimes it makes sense to return un-usable query that will be used to construct queries of subclasses. Note that when a duplicate is found, you’ll often want to expunge the original.
-
-
class
assembl.models.votes.
AbstractVoteSpecification
(**kwargs)[source]¶ Bases:
assembl.models.DiscussionBoundBase
The representation of a way to vote on an idea. There can be more than one VoteSpecification in a Question, as in the case of a 2-D widget.
-
criterion_idea_id
¶ Optional: the specification may be tied to an idea
-
classmethod
get_discussion_conditions
(discussion_id, alias_maker=None)[source]¶ Returns a list of SQLA expressions that constrain a query on this class to a given discussion.
-
populate_from_context
(context)[source]¶ If object created in this context, populate some relations from that context.
This is the magic fallback, ideally define the relationships you want populated explicitly in subclasses of this.
-
question_id
¶ Group vote specifications in questions.
-
widget_id
¶ Used by a voting widget
-
-
class
assembl.models.votes.
BinaryIdeaVote
(**kwargs)[source]¶ Bases:
assembl.models.votes.AbstractIdeaVote
-
copy
(tombstone=None, db=None, **kwargs)[source]¶ Clone object, optionally as tombstone (aka snapshot) reuse base_id. Redefine in subclasses to define arguments
-
live
¶ The live version of this object, if any.
-
-
class
assembl.models.votes.
LickertIdeaVote
(**kwargs)[source]¶ Bases:
assembl.models.votes.AbstractIdeaVote
-
copy
(tombstone=None, db=None, **kwargs)[source]¶ Clone object, optionally as tombstone (aka snapshot) reuse base_id. Redefine in subclasses to define arguments
-
live
¶ The live version of this object, if any.
-
-
class
assembl.models.votes.
MultipleChoiceIdeaVote
(**kwargs)[source]¶ Bases:
assembl.models.votes.AbstractIdeaVote
-
live
¶ The live version of this object, if any.
-
-
class
assembl.models.votes.
TokenCategorySpecification
(**kwargs)[source]¶ Bases:
assembl.models.DiscussionBoundBase
This represents a token type, with its constraints
-
classmethod
get_discussion_conditions
(discussion_id, alias_maker=None)[source]¶ Returns a list of SQLA expressions that constrain a query on this class to a given discussion.
-
typename
¶ categories which have the same typename will be comparable (example: “positive”)
-
classmethod
-
class
assembl.models.votes.
TokenIdeaVote
(**kwargs)[source]¶ Bases:
assembl.models.votes.AbstractIdeaVote
-
copy
(tombstone=None, db=None, **kwargs)[source]¶ Clone object, optionally as tombstone (aka snapshot) reuse base_id. Redefine in subclasses to define arguments
-
live
¶ The live version of this object, if any.
-
unique_query
()[source]¶ returns a couple (query, usable), with a sqla query for conflicting similar objects. usable is true if the query has to be enforced; sometimes it makes sense to return un-usable query that will be used to construct queries of subclasses. Note that when a duplicate is found, you’ll often want to expunge the original.
-