winterthur.collections.mission_report ===================================== .. py:module:: winterthur.collections.mission_report Classes ------- .. autoapisummary:: winterthur.collections.mission_report.MissionReportFileCollection winterthur.collections.mission_report.MissionReportCollection winterthur.collections.mission_report.MissionReportVehicleCollection Module Contents --------------- .. py:class:: MissionReportFileCollection(session: sqlalchemy.orm.Session, report: onegov.winterthur.models.MissionReport) Bases: :py:obj:`onegov.org.models.file.BaseImageFileCollection`\ [\ :py:obj:`onegov.winterthur.models.MissionReportFile`\ ] Manages files. :param session: The SQLAlchemy db session to use. :param type: The polymorphic type to use and to filter for, or '*' for all. :param 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. .. py:attribute:: report .. py:property:: id :type: uuid.UUID .. py:property:: association :type: onegov.core.orm.abstract.associable.RegisteredLink .. py:method:: add(*args, **kwargs) Adds a file with the given filename. The content maybe either in bytes or a file object. .. py:method:: query() -> sqlalchemy.orm.Query[onegov.winterthur.models.MissionReportFile] .. py:class:: MissionReportCollection(session: sqlalchemy.orm.Session, page: int = 0, include_hidden: bool = False, year: int | None = None) Bases: :py:obj:`onegov.core.collection.GenericCollection`\ [\ :py:obj:`onegov.winterthur.models.MissionReport`\ ], :py:obj:`onegov.core.collection.Pagination`\ [\ :py:obj:`onegov.winterthur.models.MissionReport`\ ] Provides collections with pagination, if they implement a few documented properties and methods. See :class:`onegov.ticket.TicketCollection` for an example. .. py:attribute:: session .. py:attribute:: page :value: 0 .. py:attribute:: include_hidden :value: False .. py:attribute:: year .. py:property:: model_class :type: type[onegov.winterthur.models.MissionReport] .. py:method:: __eq__(other: object) -> bool Returns True if the current and the other Pagination instance are equal. Used to find the current page in a list of pages. .. py:method:: by_id(id: uuid.UUID) -> onegov.winterthur.models.MissionReport | None .. py:method:: query() -> sqlalchemy.orm.Query[onegov.winterthur.models.MissionReport] .. py:method:: query_all() -> sqlalchemy.orm.Query[onegov.winterthur.models.MissionReport] .. py:method:: query_current_year() -> sqlalchemy.orm.Query[onegov.winterthur.models.MissionReport] .. py:method:: subset() -> sqlalchemy.orm.Query[onegov.winterthur.models.MissionReport] Returns an SQLAlchemy query containing all records that should be considered for pagination. .. py:property:: page_index :type: int Returns the current page index (starting at 0). .. py:method:: page_by_index(index: int) -> Self Returns the page at the given index. A page here means an instance of the class inheriting from the ``Pagination`` base class. .. py:method:: filter_by_year[T](query: sqlalchemy.orm.Query[T]) -> sqlalchemy.orm.Query[T] .. py:method:: mission_count() -> int | None The mission count, including hidden missions. .. py:class:: MissionReportVehicleCollection(session: sqlalchemy.orm.Session, **kwargs: Any) Bases: :py:obj:`onegov.core.collection.GenericCollection`\ [\ :py:obj:`onegov.winterthur.models.MissionReportVehicle`\ ] .. py:property:: model_class :type: type[onegov.winterthur.models.MissionReportVehicle] .. py:method:: query() -> sqlalchemy.orm.Query[onegov.winterthur.models.MissionReportVehicle]