swissvotes.collections.votes
Attributes
Classes
A collection of votes. |
Module Contents
- class swissvotes.collections.votes.SwissVoteCollection(app: onegov.swissvotes.app.SwissvotesApp, page: int = 0, from_date: datetime.date | None = None, to_date: datetime.date | None = None, legal_form: list[int] | None = None, result: list[int] | None = None, policy_area: list[str] | None = None, term: str | None = None, full_text: bool | None = None, position_federal_council: list[int] | None = None, position_national_council: list[int] | None = None, position_council_of_states: list[int] | None = None, sort_by: str | None = None, sort_order: str | None = None)[source]
Bases:
onegov.core.collection.Pagination
[onegov.swissvotes.models.SwissVote
]A collection of votes.
Supports pagination, filtering, sorting, exporting (CSV/XLSX) and batch adding/updating.
- SORT_BYS = ('date', 'legal_form', 'result', 'result_people_yeas_p', 'title', 'result_turnout')[source]
- subset() Query[SwissVote] [source]
Returns an SQLAlchemy query containing all records that should be considered for pagination.
- __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.
- property current_sort_by: str[source]
Returns the currently used sorting key.
Defaults to a reasonable value.
- property current_sort_order: str[source]
Returns the currently used sorting order.
Defaults to a reasonable value.
- sort_order_by_key(sort_by: str | None) str [source]
Returns the sort order by key.
Defaults to ‘unsorted’.
- property order_by: ColumnElement[Any][source]
Returns an SqlAlchemy expression for ordering queries based on the current sorting key and ordering.
- property term_filter_numeric: list[ColumnElement[bool]][source]
Returns a list of SqlAlchemy filter statements matching possible numeric attributes based on the term.
- property term_filter_text: list[ColumnElement[bool]][source]
Returns a list of SqlAlchemy filter statements matching possible fulltext attributes based on the term.
- property term_filter: list[ColumnElement[bool]][source]
Returns a list of SqlAlchemy filter statements based on the search term.
- by_bfs_number(bfs_number: decimal.Decimal | str) onegov.swissvotes.models.SwissVote | None [source]
Returns the vote with the given BFS number.
- property available_descriptors: list[set[decimal.Decimal]][source]
Returns a list of the used descriptor values (level 1-3).