gazette.collections.notices
¶
Module Contents¶
Classes¶
Manage a list of gazette specific official notices. |
Attributes¶
- class gazette.collections.notices.GazetteNoticeCollection(session: sqlalchemy.orm.Session, page: int = 0, state: NoticeState | None = None, term: str | None = None, order: str | None = None, direction: Literal[asc, sqlalchemy.desc] | None = None, issues: Collection[str] | None = None, categories: Collection[str] | None = None, organizations: Collection[str] | None = None, user_ids: list[uuid.UUID] | None = None, group_ids: list[uuid.UUID] | None = None, from_date: date | None = None, to_date: date | None = None, source: UUID | None = None, own: bool | None = None)[source]¶
Bases:
onegov.notice.OfficialNoticeCollection
[onegov.gazette.models.GazetteNotice
]Manage a list of gazette specific official notices.
- property used_issues: tuple[onegov.gazette.models.Issue, Ellipsis][source]¶
Returns all issues currently in use.
- property used_organizations: tuple[onegov.gazette.models.Organization, Ellipsis][source]¶
Returns all organizations currently in use.
- property used_categories: tuple[onegov.gazette.models.Category, Ellipsis][source]¶
Returns all categories currently in use.
- page_by_index(index: int) typing_extensions.Self [source]¶
Returns the page at the given index. A page here means an instance of the class inheriting from the
Pagination
base class.
- for_state(state: onegov.notice.models.NoticeState) typing_extensions.Self [source]¶
Returns a new instance of the collection with the given state.
- for_term(term: str | None) typing_extensions.Self [source]¶
Returns a new instance of the collection with the given term.
- for_order(order: str, direction: Literal[asc, sqlalchemy.desc] | None = None) typing_extensions.Self [source]¶
Returns a new instance of the collection with the given ordering. Inverts the direction if the new ordering is the same as the old one and an explicit ordering is not defined.
- for_organizations(organizations: Collection[str] | None) typing_extensions.Self [source]¶
Returns a new instance of the collection with the given organizations.
- for_categories(categories: Collection[str] | None) typing_extensions.Self [source]¶
Returns a new instance of the collection with the given categories.
- for_dates(from_date: date | None, to_date: date | None) typing_extensions.Self [source]¶
Returns a new instance of the collection with the given dates.
- filter_query(query: Query[GazetteNotice]) Query[GazetteNotice] [source]¶
Allows additionally to filter for notices with changes made by a given user.
- add(title: str, text: str | None, organization_id: str | None, category_id: str | None, user: onegov.user.User, issues: dict[str, str | None] | Iterable[str], **kwargs: Any) onegov.gazette.models.GazetteNotice [source]¶
Add a new notice.
A unique, URL-friendly name is created automatically for this notice using the title and optionally numbers for duplicate names.
A entry is added automatically to the audit trail.
Returns the created notice.
- count_by_organization() list[tuple[str, int]] [source]¶
Returns the total number of notices by organizations.
Returns a tuple
(organization name, number of notices)
for each organization. Filters by the state of the collection.
- count_by_category() list[tuple[str, int]] [source]¶
Returns the total number of notices by categories.
Returns a tuple
(category name, number of notices)
for each category. Filters by the state of the collection.