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

container_url()[source]

What is the URL where we expect to find this resource

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.

get_discussion_id()[source]

Get the ID of an associated discussion object, if any.

is_owner(user_id)[source]

The user owns this ressource, and has more permissions.

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.

container_url()[source]

What is the URL where we expect to find this resource

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.

get_discussion_id()[source]

Get the ID of an associated discussion 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.

question_id

Group vote specifications in questions.

votes_of_current_user()[source]

CAN ONLY BE CALLED FROM API V2

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.BinaryVoteSpecification(**kwargs)[source]

Bases: assembl.models.votes.AbstractVoteSpecification

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.LickertVoteSpecification(**kwargs)[source]

Bases: assembl.models.votes.AbstractVoteSpecification

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.MultipleChoiceVoteSpecification(**kwargs)[source]

Bases: assembl.models.votes.AbstractVoteSpecification

class assembl.models.votes.ResourceVoteSpecification(**kwargs)[source]

Bases: assembl.models.votes.AbstractVoteSpecification

class assembl.models.votes.TokenCategorySpecification(**kwargs)[source]

Bases: assembl.models.DiscussionBoundBase

This represents a token type, with its constraints

container_url()[source]

What is the URL where we expect to find this resource

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.

get_discussion_id()[source]

Get the ID of an associated discussion object, if any.

typename

categories which have the same typename will be comparable (example: “positive”)

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.

class assembl.models.votes.TokenVoteSpecification(**kwargs)[source]

Bases: assembl.models.votes.AbstractVoteSpecification