modified the assign task view to suit the new design
authornishanth
Wed, 24 Feb 2010 16:35:09 +0530
changeset 75 fa59955a340b
parent 74 7dc764854867
child 76 00a41fbf4958
modified the assign task view to suit the new design
taskapp/views/task.py
--- a/taskapp/views/task.py	Wed Feb 24 16:16:41 2010 +0530
+++ b/taskapp/views/task.py	Wed Feb 24 16:35:09 2010 +0530
@@ -241,11 +241,14 @@
     is_guest = True if not user.is_authenticated() else False
     is_mentor = True if user in task.mentors.all() else False
 
-    task_claimed = True if task.status == "CL" else False
+    claimed_users = task.claimed_users.all()
+    assigned_users = task.assigned_users.all()
+
+    task_claimed = True if claimed_users else False
     
     if (not is_guest) and is_mentor:
         if task_claimed:
-            user_list = ((user.id,user.username) for user in task.claimed_users.all())
+            user_list = ((user.id,user.username) for user in claimed_users)
             form = AssignTaskForm(user_list)
     
             if request.method == "POST":
@@ -255,12 +258,10 @@
                 return redirect(task_url)
             else:
                 return render_to_response('task/assign.html',{'form':form})
-        elif task.status == "AS":
-            return show_msg('The task is already assigned', task_url, 'view the task')
-        elif task.status == "OP":
-            return show_msg('No one has still claimed the task', task_url, 'view the task')
+        elif assigned_users:
+            return show_msg('When the no of users you need for the task is more than the no of users willing to do the task, I\'d say please re consider the task :P',task_url, 'view the task')
         else:
-            return show_msg('The task status is %s. how can you assign it now'%task.status, task_url, 'view the task')
+            return show_msg('Wait for ppl to claim dude... slow and steady wins the race :)', task_url, 'view the task')
     else:
         return show_msg('You are not authorised to perform this action', task_url, 'view the task')