ballot.models.election.election

Module Contents

Classes

VotesByDistrictRow

Election

Mixin providing a meta/content JSON pair. Meta is a JSON column loaded

class ballot.models.election.election.VotesByDistrictRow[source]

Bases: NamedTuple

election_id: str[source]
district: str[source]
entities: list[int][source]
counted: bool[source]
votes: int[source]
class ballot.models.election.election.Election[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.ContentMixin, onegov.ballot.models.mixins.LastModifiedMixin, onegov.ballot.models.mixins.DomainOfInfluenceMixin, onegov.ballot.models.mixins.StatusMixin, onegov.ballot.models.mixins.TitleTranslationsMixin, onegov.ballot.models.election.mixins.DerivedAttributesMixin, onegov.ballot.models.mixins.ExplanationsPdfMixin, onegov.ballot.models.party_result.mixins.PartyResultsOptionsMixin

Mixin providing a meta/content JSON pair. Meta is a JSON column loaded with each request, content is a JSON column loaded deferred (to be shown only in the detail view).

property polymorphic_base: type[Election][source]
property allocated_mandates: int[source]

Number of already allocated mandates/elected candidates.

property progress: tuple[int, int][source]

Returns a tuple with the first value being the number of counted election results and the second value being the number of total results.

property counted_entities: list[str][source]

Returns the names of the already counted entities.

Might contain an empty string in case of expats.

property has_results: bool[source]

Returns True, if the election has any results.

property results_query: Query[ElectionResult][source]
property completed: bool[source]

Overwrites StatusMixin’s ‘completed’ for compounds with manual completion.

property elected_candidates: list[tuple[str, str]][source]

Returns the first and last names of the elected candidates.

property votes_by_district: Query[VotesByDistrictRow][source]
__tablename__ = 'elections'[source]
type: Column[str][source]
__mapper_args__[source]
id: Column[str][source]
external_id: Column[str | None][source]
title_translations: Column[Mapping[str, str]][source]
title[source]
shortcode: Column[str | None][source]
date: Column[datetime.date][source]
number_of_mandates: Column[int][source]
majority_type: onegov.core.orm.mixins.dict_property[str | None][source]
absolute_majority: Column[int | None][source]
candidates: relationship[list[Candidate]][source]
results: relationship[list[ElectionResult]][source]
related_elections: relationship[AppenderQuery[ElectionRelationship]][source]
related_elections[source]
referencing_elections: relationship[AppenderQuery[ElectionRelationship]][source]
referencing_elections[source]
election_compound_id: Column[str | None][source]
election_compound: relationship[ElectionCompound][source]
eligible_voters[source]
expats[source]
received_ballots[source]
accounted_ballots[source]
blank_ballots[source]
invalid_ballots[source]
accounted_votes[source]
tacit: onegov.core.orm.mixins.dict_property[bool][source]
has_expats: onegov.core.orm.mixins.dict_property[bool][source]
domain_segment: onegov.core.orm.mixins.dict_property[str][source]
domain_supersegment: onegov.core.orm.mixins.dict_property[str][source]
colors: onegov.core.orm.mixins.dict_property[dict[str, str]][source]
title_observer(translations: Mapping[str, str]) None[source]
counted() bool[source]

True if all results have been counted.

counted() ColumnElement[bool][source]
aggregate_results(attribute: str) int[source]

Gets the sum of the given attribute from the results.

classmethod aggregate_results_expression(attribute: str) ColumnElement[int][source]

Gets the sum of the given attribute from the results, as SQL expression.

clear_results(clear_all: bool = False) None[source]

Clears all the results.