taskapp/utilities/request.py
changeset 80 8917b190c4c4
parent 78 c5bcafccc135
child 81 cade14d25a58
equal deleted inserted replaced
79:fd6b28204fb1 80:8917b190c4c4
    14     req.by = by
    14     req.by = by
    15     req.reply_date = datetime(1970,01,01)
    15     req.reply_date = datetime(1970,01,01)
    16     req.save()
    16     req.save()
    17     req.to = to
    17     req.to = to
    18     req.role = role
    18     req.role = role
    19     if task is not None:
    19     if task:
    20         req.task = task
    20         req.task = task
    21     if assigned_user is not None:
    21     if assigned_user:
    22         req.assigned_user = assigned_user
    22         req.assigned_user = assigned_user
    23     req.save()
    23     req.save()
    24 
    24 
    25 def reply_to_request(request_id, reply):
    25 def reply_to_request(request_id, reply):
    26     """
    26     """
    31     """
    31     """
    32     try:
    32     try:
    33         request = Request.objects.get(id = request_id)
    33         request = Request.objects.get(id = request_id)
    34     except Request.DoesNotExist:
    34     except Request.DoesNotExist:
    35         return False #No such request exist
    35         return False #No such request exist
    36     if request.replied is not True:
    36     if not request.replied:
    37         request.reply = reply
    37         request.reply = reply
    38         request.replied = True
    38         request.replied = True
    39         request.read = True
    39         request.read = True
    40         request.reply_date = datetime.now()
    40         request.reply_date = datetime.now()
    41         request.save()
    41         request.save()