taskapp/utilities/request.py
author anoop
Tue, 23 Feb 2010 15:27:00 +0530
changeset 58 e0ec1901dfce
child 71 801cf8fca53a
permissions -rw-r--r--
changed request model, added create_request utility.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
     1
from pytask.taskapp.models import Request
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
     2
from datetime import datetime
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
     3
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
     4
def create_request(to,by,role):
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
     5
    """
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
     6
    creates an unreplied request, based on the passed arguments
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
     7
        to - a list of users to which the notification is to be sent
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
     8
        by - sender of request
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
     9
        role - a two character field which represents the role requested
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
    10
    """
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
    11
    req = Request(creation_date=datetime.now())
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
    12
    req.by = by
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
    13
    req.reply_date = datetime(1970,01,01)
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
    14
    req.save()
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
    15
    req.to = to
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
    16
    req.role = role
e0ec1901dfce changed request model, added create_request utility.
anoop
parents:
diff changeset
    17
    req.save()