|
|
@@ -3,7 +3,7 @@ from django.db.models import get_model
|
|
3
|
3
|
Notification = get_model('notifications', 'Notification')
|
|
4
|
4
|
|
|
5
|
5
|
|
|
6
|
|
-def notify(user, msg, category=None):
|
|
|
6
|
+def notify_user(user, msg, category=None):
|
|
7
|
7
|
"""
|
|
8
|
8
|
Send a simple notification to a user
|
|
9
|
9
|
"""
|
|
|
@@ -12,9 +12,10 @@ def notify(user, msg, category=None):
|
|
12
|
12
|
subject=msg,
|
|
13
|
13
|
category=category)
|
|
14
|
14
|
|
|
15
|
|
-def send_message(user, subject, body, category):
|
|
16
|
|
- Notification.objects.create(
|
|
17
|
|
- recipient=user,
|
|
18
|
|
- subject=subject,
|
|
19
|
|
- body=body,
|
|
20
|
|
- category=category)
|
|
|
15
|
+
|
|
|
16
|
+def notify_users(users, msg, category=None):
|
|
|
17
|
+ """
|
|
|
18
|
+ Send a simple notification to an iterable of users
|
|
|
19
|
+ """
|
|
|
20
|
+ for user in users:
|
|
|
21
|
+ notify_user(user, msg, category)
|