From 1d3d1b53a48d7a48a0b8291918319227e3b8943c Mon Sep 17 00:00:00 2001 From: Adarnof Date: Wed, 17 Feb 2016 22:07:08 +0000 Subject: [PATCH] Notify function --- notifications/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/notifications/__init__.py b/notifications/__init__.py index e69de29b..d12a961d 100644 --- a/notifications/__init__.py +++ b/notifications/__init__.py @@ -0,0 +1,12 @@ +from .models import Notification + +def notify(user, title, message=None, level='info'): + notif = Notification() + notif.user = user + notif.title = title + if not message: + message = Title + notif.message = message + notif.level = level + notif.save() + logger.info("Created notification %s" % notif