gazette.models.issue ==================== .. py:module:: gazette.models.issue Classes ------- .. autoapisummary:: gazette.models.issue.IssueName gazette.models.issue.IssuePdfFile gazette.models.issue.Issue Module Contents --------------- .. py:class:: IssueName Bases: :py:obj:`NamedTuple` An issue, which consists of a year and a number. The issue might be converted from to a string in the form of 'year-number' for usage in forms and databases. .. py:attribute:: year :type: int .. py:attribute:: number :type: int .. py:method:: __repr__() -> str .. py:method:: from_string(value: str) -> Self :classmethod: .. py:class:: IssuePdfFile Bases: :py:obj:`onegov.file.File` A general file (image, document, pdf, etc), referenced in the database. Thanks to the use of `Depot `_ files can be seemingly stored in the database (with transaction guarantees), without actually storing it in the database. .. py:attribute:: __mapper_args__ .. py:class:: Issue Bases: :py:obj:`onegov.core.orm.Base`, :py:obj:`onegov.core.orm.mixins.TimestampMixin`, :py:obj:`onegov.file.AssociatedFiles` Defines an issue. .. py:attribute:: __tablename__ :value: 'gazette_issues' .. py:attribute:: id :type: sqlalchemy.Column[int] .. py:attribute:: name :type: sqlalchemy.Column[str] .. py:attribute:: number :type: sqlalchemy.Column[int | None] .. py:attribute:: date :type: sqlalchemy.Column[datetime.date] .. py:attribute:: deadline :type: sqlalchemy.Column[datetime.datetime | None] .. py:property:: pdf :type: onegov.file.File | None .. py:method:: notices(state: onegov.notice.models.NoticeState | None = None) -> sqlalchemy.orm.Query[onegov.gazette.models.notice.GazetteNotice] Returns a query to get all notices related to this issue. .. py:property:: first_publication_number :type: int Returns the first publication number of this issue based on the last issue of the same year. .. py:method:: publication_numbers(state: onegov.notice.models.NoticeState | None = None) -> dict[int, str | None] Returns a dictionary containing all publication numbers (by notice) of this issue. .. py:property:: in_use :type: bool True, if the issue is used by any notice. .. py:method:: date_observer(date_: datetime.date) -> None Changes the issue date of the notices when updating the date of the issue. At this moment, the transaction is not yet commited: Querying the current issue returns the old date. .. py:method:: publish(request: onegov.gazette.request.GazetteRequest) -> None Publishes the issue. This ensures that every accepted notice of this issue is published. It then creates the PDF while assigning the publications numbers (it uses the highest publication number of the last issue of the same year as a starting point.