ballot.models.election.election =============================== .. py:module:: ballot.models.election.election Classes ------- .. autoapisummary:: ballot.models.election.election.VotesByDistrictRow ballot.models.election.election.Election Module Contents --------------- .. py:class:: VotesByDistrictRow Bases: :py:obj:`NamedTuple` .. py:attribute:: election_id :type: str .. py:attribute:: district :type: str .. py:attribute:: entities :type: list[int] .. py:attribute:: counted :type: bool .. py:attribute:: votes :type: int .. py:class:: Election Bases: :py:obj:`onegov.core.orm.Base`, :py:obj:`onegov.core.orm.mixins.ContentMixin`, :py:obj:`onegov.ballot.models.mixins.LastModifiedMixin`, :py:obj:`onegov.ballot.models.mixins.DomainOfInfluenceMixin`, :py:obj:`onegov.ballot.models.mixins.StatusMixin`, :py:obj:`onegov.ballot.models.mixins.TitleTranslationsMixin`, :py:obj:`onegov.ballot.models.election.mixins.DerivedAttributesMixin`, :py:obj:`onegov.ballot.models.mixins.ExplanationsPdfMixin`, :py:obj:`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). .. py:attribute:: __tablename__ :value: 'elections' .. py:property:: polymorphic_base :type: type[Election] .. py:attribute:: type :type: Column[str] .. py:attribute:: __mapper_args__ .. py:attribute:: id :type: Column[str] .. py:attribute:: external_id :type: Column[str | None] .. py:attribute:: title_translations :type: Column[Mapping[str, str]] .. py:attribute:: title .. py:method:: title_observer(translations: Mapping[str, str]) -> None .. py:attribute:: shortcode :type: Column[str | None] .. py:attribute:: date :type: Column[datetime.date] .. py:attribute:: number_of_mandates :type: Column[int] .. py:property:: allocated_mandates :type: int Number of already allocated mandates/elected candidates. .. py:attribute:: majority_type :type: onegov.core.orm.mixins.dict_property[str | None] .. py:attribute:: absolute_majority :type: Column[int | None] .. py:method:: counted() -> bool True if all results have been counted. .. py:method:: counted() -> ColumnElement[bool] .. py:property:: progress :type: tuple[int, int] Returns a tuple with the first value being the number of counted election results and the second value being the number of total results. .. py:property:: counted_entities :type: list[str] Returns the names of the already counted entities. Might contain an empty string in case of expats. .. py:property:: has_results :type: bool Returns True, if the election has any results. .. py:attribute:: candidates :type: relationship[list[Candidate]] .. py:attribute:: results :type: relationship[list[ElectionResult]] .. py:property:: results_query :type: Query[ElectionResult] .. py:attribute:: related_elections :type: relationship[AppenderQuery[ElectionRelationship]] .. py:attribute:: related_elections .. py:attribute:: referencing_elections :type: relationship[AppenderQuery[ElectionRelationship]] .. py:attribute:: referencing_elections .. py:attribute:: election_compound_id :type: Column[str | None] .. py:attribute:: election_compound :type: relationship[ElectionCompound] .. py:property:: completed :type: bool Overwrites StatusMixin's 'completed' for compounds with manual completion. .. py:attribute:: eligible_voters .. py:attribute:: expats .. py:attribute:: received_ballots .. py:attribute:: accounted_ballots .. py:attribute:: blank_ballots .. py:attribute:: invalid_ballots .. py:attribute:: accounted_votes .. py:method:: aggregate_results(attribute: str) -> int Gets the sum of the given attribute from the results. .. py:method:: aggregate_results_expression(attribute: str) -> ColumnElement[int] :classmethod: Gets the sum of the given attribute from the results, as SQL expression. .. py:property:: elected_candidates :type: list[tuple[str, str]] Returns the first and last names of the elected candidates. .. py:attribute:: related_link :type: onegov.core.orm.mixins.dict_property[str | None] .. py:attribute:: related_link_label :type: onegov.core.orm.mixins.dict_property[dict[str, str] | None] .. py:attribute:: tacit :type: onegov.core.orm.mixins.dict_property[bool] .. py:attribute:: has_expats :type: onegov.core.orm.mixins.dict_property[bool] .. py:attribute:: domain_segment :type: onegov.core.orm.mixins.dict_property[str] .. py:attribute:: domain_supersegment :type: onegov.core.orm.mixins.dict_property[str] .. py:property:: votes_by_district :type: Query[VotesByDistrictRow] .. py:attribute:: colors :type: onegov.core.orm.mixins.dict_property[dict[str, str]] .. py:method:: clear_results(clear_all: bool = False) -> None Clears all the results.