gazette.collections.notices

Module Contents

Classes

GazetteNoticeCollection

Manage a list of gazette specific official notices.

Attributes

_T

TRANSLATIONS

gazette.collections.notices._T[source]
gazette.collections.notices.TRANSLATIONS: dict[str | None, str][source]
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 model_class: type[onegov.gazette.models.GazetteNotice][source]
property term_columns: list[_StrColumnLike][source]

The columns used for full text search.

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.

batch_size = 20[source]
on_request(request: onegov.gazette.request.GazetteRequest) None[source]
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.

count_by_group() list[tuple[str, int]][source]

Returns the total number of notices by groups.

Returns a tuple (group name, number of notices) for each group. Filters by the state of the collection.

count_rejected() list[tuple[str, int]][source]

Returns the number of rejected notices by user.

Returns a tuple (user name, number of rejections) for each user. Does not filter by the state of the collection.