now claims are read from notifications. we can ditchax claims model now.
authornishanth
Thu, 04 Mar 2010 18:30:55 +0530
changeset 204 fa1da06d25c9
parent 203 4774f6875a2d
child 205 0c317f68df49
now claims are read from notifications. we can ditchax claims model now.
taskapp/models.py
taskapp/views/task.py
templates/task/claim.html
--- a/taskapp/models.py	Thu Mar 04 17:56:31 2010 +0530
+++ b/taskapp/models.py	Thu Mar 04 18:30:55 2010 +0530
@@ -163,7 +163,7 @@
     role = models.CharField(max_length = 2, choices = NOTIFY_CHOICES, blank = False)
     sent_to = models.ForeignKey(User, related_name = "%(class)s_sent_to", blank = False)
     sent_from = models.ForeignKey(User, related_name = "%(class)s_sent_from", null = True, blank = True)
-    task = models.ForeignKey(Task, related_name = "%(class)s_sent_for", null = True, blank = True)
+    task = models.ForeignKey(Task, related_name = "%(class)s_task", null = True, blank = True)
 
     sub = models.CharField(max_length = 100)
     message = models.TextField()
--- a/taskapp/views/task.py	Thu Mar 04 17:56:31 2010 +0530
+++ b/taskapp/views/task.py	Thu Mar 04 18:30:55 2010 +0530
@@ -342,7 +342,10 @@
     
     user = get_user(request.user) if request.user.is_authenticated() else request.user
     task = getTask(tid)
-    claims = Claim.objects.filter(task=task)
+    #claims = Claim.objects.filter(task=task)
+    #claims = task.notifications_task.filter(role="CL",sent_to=task.created_by) 
+    # this is what the next line should be when i re sync the db
+    claims = Notification.objects.filter(task=task, sent_to=task.created_by, role="CL")
 
     mentors = task.mentors.all()
     claimed_users = task.claimed_users.all()
--- a/templates/task/claim.html	Thu Mar 04 17:56:31 2010 +0530
+++ b/templates/task/claim.html	Thu Mar 04 18:30:55 2010 +0530
@@ -7,9 +7,9 @@
         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>
-            on {{claim.creation_datetime|date:"D d M Y"}} at {{claim.creation_datetime|time:"H:i"}} wrote:<br />
-            {{claim.message}}<br />
+            <a href="/user/view/uid={{claim.sent_from.id}}">{{claim.sent_from.username}}</a>
+            on {{claim.sent_date|date:"D d M Y"}} at {{claim.sent_date|time:"H:i"}} wrote:<br />
+            {{claim.remarks}}<br />
         {% endfor %}
     {% else %}
         {% if task_claimable %}