notifications

The notifications package has an API for sending notifications.

Location: allianceauth.notifications

models

class Notification(*args, **kwargs)

Notification to a user within Auth

class Level(value)

A notification level.

DANGER = 'danger'
INFO = 'info'
SUCCESS = 'success'
WARNING = 'warning'
classmethod from_old_name(name: str)object

Map old name to enum.

Raises ValueError for invalid names.

mark_viewed()None

Mark notification as viewed.

set_level(level_name: str)None

Set notification level according to old level name, e.g. ‘CRITICAL’.

Raises ValueError on invalid level names.

managers

class NotificationManager(*args, **kwargs)
notify_user(user: object, title: str, message: Optional[str] = None, level: str = 'info')object

Sends a new notification to user. Returns newly created notification object.

user_unread_count(user_pk: int)int

returns the cached unread count for a user given by user PK

Will return -1 if user can not be found