merged
authornishanth
Thu, 04 Mar 2010 17:30:08 +0530
changeset 200 8cedb0eb175d
parent 199 946d0fe60606 (diff)
parent 198 b1a1a5017268 (current diff)
child 202 a3ff1b63b4be
merged
--- a/taskapp/events/task.py	Thu Mar 04 15:58:27 2010 +0530
+++ b/taskapp/events/task.py	Thu Mar 04 17:30:08 2010 +0530
@@ -155,6 +155,9 @@
         user_url = '<a href="/user/view/uid=%s">%s</a>'%(user.id, user.username)
         reason = "User has claimed the task and hence cannot be a mentor and this request was made invalid."
         create_notification("MT", req.sent_by, user, task=task, reply=False, remarks=reason, requested_by=req.sent_by)
+
+    for a_mentor in task.mentors.all():
+        create_notification("CL", a_mentor, user, task=task, remarks=message)
     
 def assignTask(task, added_user, assigned_by):
     """ check for the status of task and assign it to the particular user """
--- a/taskapp/utilities/notification.py	Thu Mar 04 15:58:27 2010 +0530
+++ b/taskapp/utilities/notification.py	Thu Mar 04 17:30:08 2010 +0530
@@ -222,6 +222,21 @@
             notification.remarks = remarks
             notification.message += "<b>Reason: </b>%s"%remarks
 
+    elif role == "CL":
+
+        notification.sent_from = sent_from
+        notification.task = task
+        notification.remarks = remarks
+
+        claimed_by_url = '<a href="/user/view/uid=%s">%s</a>'%(sent_from.id, sent_from.username)
+        task_url = '<a href="/task/view/tid=%s">%s</a>'%(task.id, task.title)
+
+        notification.sub = 'New claim for the task "%s"'%(task.title[:20])
+        notification.message = '%s has submitted a claim for the task "%s" mentored by you.<br />'%(claimed_by_url, task_url)
+        notification.message += '<b>Claim proposal:</b> %s'%(remarks)
+
+
+
     notification.save()
 
 def mark_notification_read(notification_id):