summaryrefslogtreecommitdiff
path: root/taskapp/events
diff options
context:
space:
mode:
authornishanth2010-03-02 03:21:20 +0530
committernishanth2010-03-02 03:21:20 +0530
commit26c34400dcbf963086e3cc5d812dc7f1333d5cc5 (patch)
treeb08ed2707efb73e54f073180a894e0814deaef1a /taskapp/events
parentc96afacd4dd27cbf092eb398862ac9dc120e9309 (diff)
downloadpytask-26c34400dcbf963086e3cc5d812dc7f1333d5cc5.tar.gz
pytask-26c34400dcbf963086e3cc5d812dc7f1333d5cc5.tar.bz2
pytask-26c34400dcbf963086e3cc5d812dc7f1333d5cc5.zip
implemented deleting of a task.
Diffstat (limited to 'taskapp/events')
-rw-r--r--taskapp/events/task.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/taskapp/events/task.py b/taskapp/events/task.py
index 6fd3fef..04cdd2d 100644
--- a/taskapp/events/task.py
+++ b/taskapp/events/task.py
@@ -230,8 +230,6 @@ def completeTask(task, marked_by):
for a_mentor in task.mentors.all():
create_notification(role="CM", sent_to=a_mentor, sent_from=marked_by, task=task)
-
-
def closeTask(task, closed_by, reason=None):
""" set the status of task as CD.
generate notifications accordingly.
@@ -254,4 +252,16 @@ def closeTask(task, closed_by, reason=None):
for a_mentor in task.mentors.all():
create_notification(role="CD", sent_to=a_mentor, sent_from=closed_by, task=task, remarks=reason)
+def deleteTask(task, deleted_by, reason=None):
+ """ set the task status as DL
+ notify all its other viewers about the deleting of task.
+ """
+
+ task.status = "DL"
+ task.save()
+
+ pending_requests = task.request_task.filter(is_replied=False,is_valid=True)
+ pending_requests.update(is_valid=False)
+ for a_mentor in task.mentors.exclude(id=deleted_by.id):
+ create_notification("DL", sent_to=a_mentor, sent_from=deleted_by, task=task, remarks=reason)