winterthur.collections.mission_report

Classes

MissionReportFileCollection

Manages files.

MissionReportCollection

Provides collections with pagination, if they implement a few

MissionReportVehicleCollection

Module Contents

class winterthur.collections.mission_report.MissionReportFileCollection(session: sqlalchemy.orm.Session, report: onegov.winterthur.models.MissionReport)[source]

Bases: onegov.org.models.file.BaseImageFileCollection[onegov.winterthur.models.MissionReportFile]

Manages files.

Parameters:
  • session – The SQLAlchemy db session to use.

  • type – The polymorphic type to use and to filter for, or ‘*’ for all.

  • allow_duplicates

    Prevents duplicates if set to false. Duplicates are detected before pre-processing, so already stored files may be downloaded and added again, as they might have changed during the upload.

    Note that this does not change existing files. It only prevents new duplicates from being added.

report[source]
property id: uuid.UUID[source]
property association: onegov.core.orm.abstract.associable.RegisteredLink[source]
add(*args, **kwargs)[source]

Adds a file with the given filename. The content maybe either in bytes or a file object.

query() sqlalchemy.orm.Query[onegov.winterthur.models.MissionReportFile][source]
class winterthur.collections.mission_report.MissionReportCollection(session: sqlalchemy.orm.Session, page: int = 0, include_hidden: bool = False, year: int | None = None)[source]

Bases: onegov.core.collection.GenericCollection[onegov.winterthur.models.MissionReport], onegov.core.collection.Pagination[onegov.winterthur.models.MissionReport]

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

See onegov.ticket.TicketCollection for an example.

session[source]
page = 0[source]
include_hidden = False[source]
year[source]
property model_class: type[onegov.winterthur.models.MissionReport][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.

by_id(id: uuid.UUID) onegov.winterthur.models.MissionReport | None[source]
query() sqlalchemy.orm.Query[onegov.winterthur.models.MissionReport][source]
query_all() sqlalchemy.orm.Query[onegov.winterthur.models.MissionReport][source]
query_current_year() sqlalchemy.orm.Query[onegov.winterthur.models.MissionReport][source]
subset() sqlalchemy.orm.Query[onegov.winterthur.models.MissionReport][source]

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

property page_index: int[source]

Returns the current page index (starting at 0).

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.

filter_by_year[T](query: sqlalchemy.orm.Query[T]) sqlalchemy.orm.Query[T][source]
mission_count() int | None[source]

The mission count, including hidden missions.

class winterthur.collections.mission_report.MissionReportVehicleCollection(session: sqlalchemy.orm.Session, **kwargs: Any)[source]

Bases: onegov.core.collection.GenericCollection[onegov.winterthur.models.MissionReportVehicle]

property model_class: type[onegov.winterthur.models.MissionReportVehicle][source]
query() sqlalchemy.orm.Query[onegov.winterthur.models.MissionReportVehicle][source]