12 lines
473 B
Python
12 lines
473 B
Python
from core.apps.notifications.models import Notification
|
|
from core.apps.notifications.utils.send_notification import send_notification, send_web_notification
|
|
|
|
|
|
def notify_user(user, title, body, data):
|
|
tokens = Notification.objects.filter(user=user)
|
|
for token in tokens:
|
|
if token.type == 'mobile':
|
|
send_notification(token.token, title, body, data)
|
|
if token.type == 'web':
|
|
send_web_notification(token.token, title, body, data)
|