gazette.collections.notices

Attributes

TRANSLATIONS

Classes

GazetteNoticeCollection

Manage a list of gazette specific official notices.

Module Contents

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', '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.

batch_size = 20[source]
property model_class: type[onegov.gazette.models.GazetteNotice][source]
from_date[source]
to_date[source]
source[source]
own[source]
own_user_id: str | None = None[source]
on_request(request: onegov.gazette.request.GazetteRequest) None[source]
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.

for_state(state: onegov.notice.models.NoticeState) Self[source]

Returns a new instance of the collection with the given state.

for_term(term: str | None) Self[source]

Returns a new instance of the collection with the given term.

for_order(order: str, direction: Literal['asc', 'desc'] | None = None) 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) Self[source]

Returns a new instance of the collection with the given organizations.

for_categories(categories: Collection[str] | None) Self[source]

Returns a new instance of the collection with the given categories.

for_dates(from_date: date | None, to_date: date | None) Self[source]

Returns a new instance of the collection with the given dates.

property term_columns: list[onegov.notice.collections._StrColumnLike][source]

The columns used for full text search.

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.

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.