ballot.collections.votes

Module Contents

Classes

VoteCollection

Provides collections with pagination, if they implement a few

class ballot.collections.votes.VoteCollection(session: sqlalchemy.orm.Session, page: int = 0, year: int | None = None)[source]

Bases: onegov.core.collection.Pagination[onegov.ballot.models.Vote]

Provides collections with pagination, if they implement a few documented properties and methods.

See onegov.ticket.TicketCollection for an example.

property page_index: int[source]

Returns the current page index (starting at 0).

page: int[source]
__eq__(other: object) bool[source]

Returns True if the current and the other Pagination instance are equal. Used to find the current page in a list of pages.

subset() Query[Vote][source]

Returns an SQLAlchemy query containing all records that should be considered for pagination.

page_by_index(index: int) typing_extensions.Self[source]

Returns the page at the given index. A page here means an instance of the class inheriting from the Pagination base class.

for_year(year: int | None) typing_extensions.Self[source]
query() Query[Vote][source]
get_latest() list[onegov.ballot.models.Vote] | None[source]

Returns the votes with the latest date.

get_years() list[int][source]

Returns a list of years for which there are votes.

by_date(date: VoteCollection.by_date.date) list[onegov.ballot.models.Vote][source]

Returns the votes on the given date.

by_year(year: int | None = None) list[onegov.ballot.models.Vote][source]

Returns the votes for the current/given year.

by_id(id: str) onegov.ballot.models.Vote | None[source]

Returns the vote by id.