SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 333ce2bd authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Easy sending of notifications using signals

parent 89722967
No related branches found
No related tags found
No related merge requests found
default_app_config = 'notifications.apps.Config'
...@@ -3,3 +3,8 @@ from django.apps import AppConfig ...@@ -3,3 +3,8 @@ from django.apps import AppConfig
class NotificationsConfig(AppConfig): class NotificationsConfig(AppConfig):
name = 'notifications' name = 'notifications'
def ready(self):
super().ready()
import notifications.signals
notifications.notify = notifications.signals.notify
from django.dispatch import Signal
notify = Signal(providing_args=[
'recipient', 'actor', 'verb', 'action_object', 'target', 'description',
'timestamp', 'level'
])
# Basic working method to send a notification to a user using signals:
# ---
# from notifications.signals import notify
# notify.send(user, recipient=user, verb='you reached level 10')
# ---
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment