commited.
--- a/taskapp/models.py Wed Feb 24 16:08:31 2010 +0530
+++ b/taskapp/models.py Wed Feb 24 16:10:24 2010 +0530
@@ -140,6 +140,7 @@
reply_date = models.DateTimeField()
replied = models.BooleanField(default = False)
task = models.ForeignKey(Task,related_name = "%(class)s_task", blank = True, null = True)
+ assigned_user = models.ForeignKey(User, related_name = "%(class)s_assigned_user", blank = True, null = True)
class Notification(models.Model):
--- a/taskapp/utilities/request.py Wed Feb 24 16:08:31 2010 +0530
+++ b/taskapp/utilities/request.py Wed Feb 24 16:10:24 2010 +0530
@@ -1,12 +1,14 @@
from pytask.taskapp.models import Request
from datetime import datetime
-def create_request(to,by,role):
+def create_request(to,by,role,task=None,assigned_user=None):
"""
creates an unreplied request, based on the passed arguments
to - a list of users to which the notification is to be sent
by - sender of request
role - a two character field which represents the role requested
+ task - a requesting task (useful for sending admins a request to give Pynts to the user, assigning a user to a task)
+ assigned_user - user to whom the Pynts/Task is assigned to(useful for sending admins a request to give Pynts to the user, assigning a user to a task)
"""
req = Request(creation_date=datetime.now())
req.by = by
@@ -14,4 +16,8 @@
req.save()
req.to = to
req.role = role
+ if task not None:
+ req.task = task
+ if assigned_user not None:
+ req.assigned_user = assigned_user
req.save()