taskapp/utilities/request.py
changeset 58 e0ec1901dfce
child 71 801cf8fca53a
equal deleted inserted replaced
57:67e0d0a915e3 58:e0ec1901dfce
       
     1 from pytask.taskapp.models import Request
       
     2 from datetime import datetime
       
     3 
       
     4 def create_request(to,by,role):
       
     5     """
       
     6     creates an unreplied request, based on the passed arguments
       
     7         to - a list of users to which the notification is to be sent
       
     8         by - sender of request
       
     9         role - a two character field which represents the role requested
       
    10     """
       
    11     req = Request(creation_date=datetime.now())
       
    12     req.by = by
       
    13     req.reply_date = datetime(1970,01,01)
       
    14     req.save()
       
    15     req.to = to
       
    16     req.role = role
       
    17     req.save()