gazette.models.notice
Classes
Mixin providing a cached version of the user name. |
|
Mixin providing a cached version of the group name. |
|
A general file (image, document, pdf, etc), referenced in the database. |
|
An official notice with extras. |
|
A changelog entry for an official notice. |
Module Contents
- class gazette.models.notice.CachedUserNameMixin[source]
Mixin providing a cached version of the user name.
There needs to be:
a
user
relationship (which has no dynamic backref)a meta column
The observer needs to be registered in the children:
@observes('user', 'user.realname', 'user.username') def user_observer(self, user, realname, username): if hasattr(self, '_user_observer'): self._user_observer(user, realname, username)
- user: sqlalchemy.orm.relationship[onegov.user.User | None] | sqlalchemy.orm.relationship[onegov.user.User][source]
- class gazette.models.notice.CachedGroupNameMixin[source]
Mixin providing a cached version of the group name.
There needs to be:
a
group
relationship (which has no dynamic backref)a meta column
The observer needs to be registered in the children:
@observes('group', 'group.name') def group_observer(self, group, name): if hasattr(self, '_group_observerr'): self._group_observerr(user, realname, username)
- group: sqlalchemy.orm.relationship[onegov.user.UserGroup | None] | sqlalchemy.orm.relationship[onegov.user.UserGroup][source]
- class gazette.models.notice.GazetteNoticeFile[source]
Bases:
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.
- linked_official_notices: sqlalchemy.orm.relationship[list[GazetteNotice]][source]
- class gazette.models.notice.GazetteNotice[source]
Bases:
onegov.notice.OfficialNotice
,CachedUserNameMixin
,CachedGroupNameMixin
,onegov.file.AssociatedFiles
An official notice with extras.
We use a combination of the categories/organizations HSTORE and the individual category/organization columns. The ID of the category/ organization is stored in the HSTORE column and the actual name ist copied when calling
apply_meta
.We store only the issue names (year-number) in the HSTORE.
It’s possible to add a changelog entry by calling
add_change
. Changelog entries are created for state changes by default.The user name accessible by
user_name
gets cached in case the user is deleted.The group name accessible by
group_name
gets cached in case the group is deleted.- changes: relationship[AppenderQuery[GazetteNoticeChange]][source]
- user_observer(user: onegov.user.User | None, realname: str | None, username: str | None) None [source]
- add_change(request: onegov.gazette.request.GazetteRequest, event: str, text: str | None = None) None [source]
Adds en entry to the changelog.
- submit(request: onegov.gazette.request.GazetteRequest) None [source]
Submit a drafted notice.
This automatically adds en entry to the changelog.
- reject(request: onegov.gazette.request.GazetteRequest, comment: str) None [source]
Reject a submitted notice.
This automatically adds en entry to the changelog.
- accept(request: onegov.gazette.request.GazetteRequest) None [source]
Accept a submitted notice.
This automatically adds en entry to the changelog.
- publish(request: onegov.gazette.request.GazetteRequest) None [source]
Publish an accepted notice.
This automatically adds en entry to the changelog.
- property category_id: str | None[source]
The ID of the category. We store this the ID in the HSTORE (we use only one!) and additionaly store the title of the category in the category column.
- property organization_id: str | None[source]
The ID of the organization. We store this the ID in the HSTORE (we use only one!) and additionaly store the title of the organization in the organization column.
- class gazette.models.notice.GazetteNoticeChange[source]
Bases:
onegov.chat.Message
,CachedUserNameMixin
A changelog entry for an official notice.
- user_observer(user: onegov.user.User | None, realname: str | None, username: str | None) None [source]
- notice: relationship[GazetteNotice][source]