Implement notifications for admin users (#700)

* First stab at notification settings

* Add "global" setting for notification levels

* Trigger notification task

* Get users with permission for event

* Actually send notification emails

* More notifications

* Allow to turn off notifications

* Link in email to pause all notifications

* Add NotificationType to wordlist

* Add notification tests

* Add documentation

* Rebase fixes
This commit is contained in:
Raphael Michel
2017-12-14 22:06:08 +01:00
committed by GitHub
parent f0a1397eea
commit 128203800c
28 changed files with 1363 additions and 172 deletions

View File

@@ -47,6 +47,8 @@ class LoggingMixin:
"""
from .log import LogEntry
from .event import Event
from ..notifications import get_all_notification_types
from ..services.notifications import notify
event = None
if isinstance(self, Event):
@@ -60,6 +62,9 @@ class LoggingMixin:
logentry.data = json.dumps(data, cls=CustomJSONEncoder)
logentry.save()
if action in get_all_notification_types():
notify.apply_async(args=(logentry.pk,))
class LoggedModel(models.Model, LoggingMixin):