notifications
The notifications package has an API for sending notifications.
Location: allianceauth.notifications
Example
from allianceauth.notifications.models import Notification
def notify_user_view(request):
'''Simple view sending a notification to the user'''
Notification.objects.notify_user(
user=request.user,
title="Some title",
message="Some message",
level=Notification.Level.INFO,
)
models
- class Notification(*args, **kwargs)[source]
Notification to a user within Auth
- Parameters:
id (AutoField) – Primary key: ID
level (CharField) – Level
title (CharField) – Title
message (TextField) – Message
timestamp (DateTimeField) – Timestamp
viewed (BooleanField) – Viewed
Relationship fields:
- Parameters:
user (
ForeignKeytoUser) – User (related name:notification)