taskapp/utilities/notification.py
changeset 167 b61e45074ba1
parent 162 d378eff02f2e
child 183 c088c79a225c
equal deleted inserted replaced
166:ac72d641046e 167:b61e45074ba1
   167             notification.message += "<b>Remarks:</b> %s"%remarks
   167             notification.message += "<b>Remarks:</b> %s"%remarks
   168 
   168 
   169     elif role == "AU":
   169     elif role == "AU":
   170 
   170 
   171         notification.task = task
   171         notification.task = task
       
   172         notification.sent_from = sent_from
   172         added_user = sent_to
   173         added_user = sent_to
   173         mentor = sent_from
   174         mentor = sent_from
   174         assigned_by_url = '<a href="/user/view/uid=%s">%s</a>'%(mentor.id, mentor.username)
   175         assigned_by_url = '<a href="/user/view/uid=%s">%s</a>'%(mentor.id, mentor.username)
   175         task_url= '<a href="/task/view/tid=%s">%s</a>'%(task.id, task.title)
   176         task_url= '<a href="/task/view/tid=%s">%s</a>'%(task.id, task.title)
   176 
   177 
   192             notification.message += "</ul><br />"
   193             notification.message += "</ul><br />"
   193 
   194 
   194     elif role == "RU":
   195     elif role == "RU":
   195 
   196 
   196         notification.task = task
   197         notification.task = task
       
   198         notification.sent_from = sent_from
   197         removed_user = sent_to
   199         removed_user = sent_to
   198         mentor = sent_from
   200         mentor = sent_from
   199         removed_by_url = '<a href="/user/view/uid=%s">%s</a>'%(mentor.id, mentor.username)
   201         removed_by_url = '<a href="/user/view/uid=%s">%s</a>'%(mentor.id, mentor.username)
   200         task_url = '<a href="/task/view/tid=%s">%s</a>'%(task.id, task.title)
   202         task_url = '<a href="/task/view/tid=%s">%s</a>'%(task.id, task.title)
   201         claim_url = '<a href="/task/claim/tid=%s">%s</a>'%(task.id, "clicking here")
   203         claim_url = '<a href="/task/claim/tid=%s">%s</a>'%(task.id, "clicking here")
   205         notification.message += "if you want to work on the task again, you can claim the task by %s.<br />"%claim_url
   207         notification.message += "if you want to work on the task again, you can claim the task by %s.<br />"%claim_url
   206         if remarks:
   208         if remarks:
   207             notification.remarks = remarks
   209             notification.remarks = remarks
   208             notification.message += "<b>Reason: </b>%s"%(remarks)
   210             notification.message += "<b>Reason: </b>%s"%(remarks)
   209 
   211 
       
   212     elif role == "DL":
       
   213 
       
   214         notification.sent_from = sent_from
       
   215         notification.task = task
       
   216         deleted_by_url = '<a href="/user/view/uid=%s">%s</a>'%(sent_from.id, sent_from.username)
       
   217 
       
   218         notification.sub = "Task deleted"
       
   219         notification.message = 'The unpublished task "%s" viewable by you has been deleted by its creator %s.<br />'%(task.title, deleted_by_url)
       
   220 
       
   221         if remarks:
       
   222             notification.remarks = remarks
       
   223             notification.message += "<b>Reason: </b>%s"%remarks
   210 
   224 
   211     notification.save()
   225     notification.save()
   212 
   226 
   213 def mark_notification_read(notification_id):
   227 def mark_notification_read(notification_id):
   214     """
   228     """