summaryrefslogtreecommitdiff
path: root/taskapp/utilities/notification.py
blob: 816e8bff910f70fc4a09b9d8a44b7d07166359c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from pytask.taskapp.models import Notification
from datetime import datetime

def create_notification(to,subject,message):
    """
    creates a notification based on the passed arguments.
        to - a list of users to which the notification is to be sent
        subject - subject of the notification message to be sent
        message - message body of the notification
    """
    notification = Notification(sent_date = datetime.now())
    notification.save()
    notification.to = to
    notification.sub = subject
    notification.message = message
    notification.save()