fixed a bug in templates/task/claim.html which required modification of views/task.py; also changed the no.of char limit on task title .
authornishanth
Fri, 05 Feb 2010 16:05:54 +0530
changeset 33 0d0ea7b188d5
parent 32 78adf44d895d
child 34 22f302094806
fixed a bug in templates/task/claim.html which required modification of views/task.py; also changed the no.of char limit on task title .
taskapp/models.py
taskapp/models.pyc
taskapp/views/task.py
templates/task/claim.html
--- a/taskapp/models.py	Fri Feb 05 15:42:35 2010 +0530
+++ b/taskapp/models.py	Fri Feb 05 16:05:54 2010 +0530
@@ -46,7 +46,7 @@
 
 class Task(models.Model):
     
-    title = models.CharField(max_length = 200, unique = True)
+    title = models.CharField(max_length = 100, unique = True)
     desc = models.TextField()
     status = models.CharField(max_length = 2, choices = STATUS_CHOICES, default = "UP")
     tags = models.CharField(max_length = 200, blank = True)
Binary file taskapp/models.pyc has changed
--- a/taskapp/views/task.py	Fri Feb 05 15:42:35 2010 +0530
+++ b/taskapp/views/task.py	Fri Feb 05 16:05:54 2010 +0530
@@ -189,12 +189,14 @@
 
     task_claimable = True if task.status in ["OP", "RE", "CL"] else False
     user_can_claim = True if  task_claimable and not ( is_guest or is_mentor ) and ( user not in task.claimed_users.all() )  else False
+    task_claimed = True if task.status == "CL" else False
     
     context = {'is_mentor':is_mentor,
                'task':task,
                'claims':claims,
                'user_can_claim':user_can_claim,
                'task_claimable':task_claimable,
+               'task_claimed':task_claimed,
                'errors':errors}
     
     if not is_guest:
@@ -239,8 +241,12 @@
                 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')
         else:
-            return show_msg('The task is already assigned', task_url, 'view the task')
+            return show_msg('The task status is %s. how can you assign it now'%task.status, task_url, 'view the task')
     else:
         return show_msg('You are not authorised to perform this action', task_url, 'view the task')
         
--- a/templates/task/claim.html	Fri Feb 05 15:42:35 2010 +0530
+++ b/templates/task/claim.html	Fri Feb 05 16:05:54 2010 +0530
@@ -1,12 +1,16 @@
 {% extends 'base.html' %}
 {% block content %}
-    List of all the claims for the task <a href="/task/view/tid={{task.id}}">{{task.title}}</a><br />
-    {% for claim in claims %}
-        <hr />
-        <a href="/user/view/uid={{claim.user.id}}">{{claim.user.username}}</a> at {{claim.creation_datetime.ctime}} wrote:<br />
-        {{claim.message}}<br />
-    {% endfor %}
-    {% if task_claimable and is_mentor %}
+    {% if claims %}
+        List of all the claims for the task <a href="/task/view/tid={{task.id}}">{{task.title}}</a><br />
+        {% for claim in claims %}
+            <hr />
+            <a href="/user/view/uid={{claim.user.id}}">{{claim.user.username}}</a> at {{claim.creation_datetime.ctime}} wrote:<br />
+            {{claim.message}}<br />
+        {% endfor %}
+    {% else %}
+        There are no claims for task <a href="/task/view/tid={{task.id}}">{{task.title}}</a> yet.
+    {% endif %}
+    {% if task_claimed and is_mentor %}
         <a href="/task/assign/tid={{task.id}}">Assign task</a>
     {% endif %}
     {% if user_can_claim %}