election_day.collections.elections

Classes

ElectionCollection

Module Contents

class election_day.collections.elections.ElectionCollection(session: sqlalchemy.orm.Session, page: int = 0, year: int | None = None)[source]

Bases: onegov.core.collection.Pagination[onegov.election_day.models.Election]

page: int[source]
session[source]
year = None[source]
__eq__(other: object) → bool[source]
subset() → sqlalchemy.orm.Query[onegov.election_day.models.Election][source]
property page_index: int[source]
page_by_index(index: int) → Self[source]
for_year(year: int | None) → Self[source]
query() → sqlalchemy.orm.Query[onegov.election_day.models.Election][source]
get_latest() → list[onegov.election_day.models.Election] | None[source]

Returns the elections with the latest date.

get_years() → list[int][source]

Returns a list of years for which there are elections.

by_date(date: ElectionCollection.by_date.date) → list[onegov.election_day.models.Election][source]

Returns the elections on the given date.

by_year(year: int | None = None) → list[onegov.election_day.models.Election][source]

Returns the elections for the current/given year.

by_id(id: str) → onegov.election_day.models.Election | None[source]

Returns the election by id.