The notifications package has an API for sending notifications.

Location: allianceauth.notifications


class Notification(*args, **kwargs)[source]

Notification to a user within Auth


Relationship fields:


user (ForeignKey to User) – User (related name: notification)

class Level(value)[source]

A notification level.

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

Map old name to enum.

Raises ValueError for invalid names.

mark_viewed() None[source]

Mark notification as viewed.

set_level(level_name: str) None[source]

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

Raises ValueError on invalid level names.


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

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

user_unread_count(user_pk: int) int[source]

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

Will return -1 if user can not be found