election_day.collections.election_compounds
Classes
Provides collections with pagination, if they implement a few |
Module Contents
- class election_day.collections.election_compounds.ElectionCompoundCollection(session: sqlalchemy.orm.Session, page: int = 0, year: int | None = None)[source]
Bases:
onegov.core.collection.Pagination
[onegov.election_day.models.ElectionCompound
]Provides collections with pagination, if they implement a few documented properties and methods.
See
onegov.ticket.TicketCollection
for an example.- __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[ElectionCompound] [source]
Returns an SQLAlchemy query containing all records that should be considered for pagination.
- page_by_index(index: int) Self [source]
Returns the page at the given index. A page here means an instance of the class inheriting from the
Pagination
base class.
- query() Query[ElectionCompound] [source]
- get_latest() list[onegov.election_day.models.ElectionCompound] | None [source]
Returns the election compounds with the latest date.
- by_date(date: ElectionCompoundCollection.by_date.date) list[onegov.election_day.models.ElectionCompound] [source]
Returns the election compounds on the given date.