ballot.models.election.candidate

Module Contents

Classes

Candidate

A candidate.

Attributes

list_t

ballot.models.election.candidate.list_t[source]
class ballot.models.election.candidate.Candidate[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin

A candidate.

property percentage_by_entity: dict[int, onegov.ballot.types.EntityPercentage][source]

Returns the percentage of votes by the entity. Includes uncounted entities and entities with no results available.

property percentage_by_district: dict[str, onegov.ballot.types.DistrictPercentage][source]

Returns the percentage of votes aggregated by the distict. Includes uncounted districts and districts with no results available.

__tablename__ = 'candidates'[source]
id: Column[uuid.UUID][source]
candidate_id: Column[str][source]
family_name: Column[str][source]
first_name: Column[str][source]
elected: Column[bool][source]
gender: Column[Gender | None][source]
year_of_birth: Column[int | None][source]
election_id: Column[str][source]
election: relationship[Election][source]
list_id: Column[uuid.UUID | None][source]
list: relationship[List][source]
party: Column[str | None][source]
results: relationship[list_t[CandidateResult]][source]
panachage_results: relationship[list_t[CandidatePanachageResult]][source]
panachage_results[source]
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.