election_day.models.election.election

Classes

VotesByDistrictRow

Election

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

Module Contents

class election_day.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 election_day.models.election.election.Election[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.ContentMixin, onegov.election_day.models.mixins.LastModifiedMixin, onegov.election_day.models.mixins.DomainOfInfluenceMixin, onegov.election_day.models.mixins.StatusMixin, onegov.election_day.models.mixins.TitleTranslationsMixin, onegov.election_day.models.mixins.IdFromTitlesMixin, onegov.election_day.models.election.mixins.DerivedAttributesMixin, onegov.election_day.models.mixins.ExplanationsPdfMixin, onegov.election_day.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).

__tablename__ = 'elections'[source]
property polymorphic_base: type[Election][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]
short_title_translations: Column[Mapping[str, str] | None][source]
short_title[source]
title_observer(title_translations: Mapping[str, str], short_title_translations: Mapping[str, str]) None[source]
shortcode: Column[str | None][source]
date: Column[datetime.date][source]
number_of_mandates: Column[int][source]
property allocated_mandates: int[source]

Number of already allocated mandates/elected candidates.

majority_type: onegov.core.orm.mixins.dict_property[str | None][source]
absolute_majority: Column[int | None][source]
counted: sqlalchemy.Column[bool][source]
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.

candidates: relationship[list[Candidate]][source]
results: relationship[list[ElectionResult]][source]
property results_query: Query[ElectionResult][source]
related_elections: relationship[AppenderQuery[ElectionRelationship]][source]
referencing_elections: relationship[AppenderQuery[ElectionRelationship]][source]
election_compound_id: Column[str | None][source]
election_compound: relationship[ElectionCompound][source]
property completed: bool[source]

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

eligible_voters[source]
expats[source]
received_ballots[source]
accounted_ballots[source]

The number of accounted ballots.

blank_ballots[source]
invalid_ballots[source]
accounted_votes[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.

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

Returns the first and last names of the elected candidates.

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]
property votes_by_district: Query[VotesByDistrictRow][source]
colors: onegov.core.orm.mixins.dict_property[dict[str, str]][source]
clear_results(clear_all: bool = False) None[source]

Clears all the results.

data_sources: relationship[list[DataSourceItem]][source]
notifications: relationship[AppenderQuery[Notification]][source]
screens: relationship[AppenderQuery[Screen]][source]