System notification journal
GlobalAlertJournal is a read-only proxy for stored GlobalAlert records.
It gives operators a searchable view of system messages, including resolved
ones. The personal inbox continues to handle read receipts and comments
for each recipient.
Grant access and add navigation
Grant django_chassis.view_globalalertjournal to the required staff group.
The normal Admin access rules, audience on the stored alert and its optional
permission still apply to individual records. A global alert is addressed
to eligible staff. A targeted alert is shown to its recipients. A
superuser-only publication is restricted to superusers.
When the AdminSite's notification feature is enabled, Chassis registers the proxy admin automatically. To expose it in a section, include a model sidebar item.
from django_chassis.options import SidebarModelItemOption
journal_item = SidebarModelItemOption(
model='django_chassis.globalalertjournal',
icon_class='fa-solid fa-bell',
)
Use global_alert_inbox_permission on the AdminSite to require an
additional inbox grant. The journal has its own view permission.
global_alert_excluded_slugs hides selected alerts from the inbox and journal on that site.
Publish and close a system notice
Publish from a project check, background task or service. Use a stable key for each condition so repeats update the same row.
from django_chassis.services.global_alert_service import GlobalAlertService
def report_catalog_storage(is_unavailable: bool) -> None:
GlobalAlertService.publish(
key='catalog-storage',
object_label='Catalog storage',
message='Catalog files are unavailable' if is_unavailable else 'Catalog storage was restored',
is_active=is_unavailable,
superuser_only=True,
)
With is_active=True, Chassis creates or updates the row. With
is_active=False, it closes an existing row and preserves its identity,
creation date, recipients and read receipts. Reopening it under the same key
also preserves read receipts. A new key starts a separate acknowledgement cycle.
A first report of a healthy condition leaves the journal empty for that key.
Callable or signal
providers that only produce live inbox items are not stored journal rows.
Call GlobalAlertService.synchronize_geoip() from an operational check to
publish or close the built-in GeoIP database notice.
See notification recipients and inbox and the training Admin.