taskapp/utilities/request.py
changeset 81 cade14d25a58
parent 80 8917b190c4c4
child 82 7c38ff64aee7
equal deleted inserted replaced
80:8917b190c4c4 81:cade14d25a58
     1 from pytask.taskapp.models import Request
     1 from pytask.taskapp.models import Request
     2 from datetime import datetime
     2 from datetime import datetime
     3 
     3 
     4 def create_request(to,by,role,task=None,assigned_user=None):
     4 def create_request(to,by,role,task=None,assigned_user=None,pynts=0):
     5     """
     5     """
     6     creates an unreplied request, based on the passed arguments
     6     creates an unreplied request, based on the passed arguments
     7         to - a list of users to which the notification is to be sent
     7         to - a list of users to which the notification is to be sent
     8         by - sender of request
     8         by - sender of request
     9         role - a two character field which represents the role requested
     9         role - a two character field which represents the role requested
    18     req.role = role
    18     req.role = role
    19     if task:
    19     if task:
    20         req.task = task
    20         req.task = task
    21     if assigned_user:
    21     if assigned_user:
    22         req.assigned_user = assigned_user
    22         req.assigned_user = assigned_user
       
    23     req.pynts = pynts
    23     req.save()
    24     req.save()
    24 
    25 
    25 def reply_to_request(request_id, reply):
    26 def reply_to_request(request_id, reply):
    26     """
    27     """
    27     makes a request replied with the given reply.
    28     makes a request replied with the given reply.