taskapp/utilities/notification.py
changeset 57 67e0d0a915e3
child 78 c5bcafccc135
equal deleted inserted replaced
56:05e10eccd515 57:67e0d0a915e3
       
     1 from pytask.taskapp.models import Notification
       
     2 from datetime import datetime
       
     3 
       
     4 def create_notification(to,subject,message):
       
     5     """
       
     6     creates a notification based on the passed arguments.
       
     7         to - a list of users to which the notification is to be sent
       
     8         subject - subject of the notification message to be sent
       
     9         message - message body of the notification
       
    10     """
       
    11     notification = Notification(sent_date = datetime.now())
       
    12     notification.save()
       
    13     notification.to = to
       
    14     notification.sub = subject
       
    15     notification.message = message
       
    16     notification.save()