notifications

The notifications package has an API for sending notifications.

Location: allianceauth.notifications

models

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

Notification to a user within Auth

Parameters:

Relationship fields:

Parameters:

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

class Level(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[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.

managers

class NotificationManager(*args, **kwargs)[source]
notify_user(user: object, title: str, message: 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