now view credits page shows all the credits.. including the pending and rejected ones.
authornishanth
Sun, 28 Feb 2010 02:45:21 +0530
changeset 135 0ede6b2c5cd1
parent 134 3a49a7e23442
child 136 8632a44b743d
now view credits page shows all the credits.. including the pending and rejected ones.
taskapp/views/task.py
templates/task/assigncredits.html
--- a/taskapp/views/task.py	Sun Feb 28 02:07:51 2010 +0530
+++ b/taskapp/views/task.py	Sun Feb 28 02:45:21 2010 +0530
@@ -435,12 +435,14 @@
                 choices.extend([(_.id, _.username) for _  in task.assigned_users.all() ])
             prev_credits = task.credit_set.all()
             ## here we can ditchax credits model and use the request model
+            credit_requests = task.request_task.filter(role="PY",is_valid=True).order_by('creation_date').reverse()
             form = AssignCreditForm(choices)
 
             context = {
                 'user':user,
                 'task':task,
                 'prev_credits':prev_credits,
+                'credit_requests':credit_requests,
                 'form':form,
             }
 
--- a/templates/task/assigncredits.html	Sun Feb 28 02:07:51 2010 +0530
+++ b/templates/task/assigncredits.html	Sun Feb 28 02:45:21 2010 +0530
@@ -3,19 +3,36 @@
     {{task.title}}
 {% endblock %}
 {% block content %}
-        <a href="/task/view/tid={{task.id}}">Click here</a> to return to the task.
-        {% if prev_credits %}
-            <hr />
-            <br/>Previous credits:<br />
-            {% for credit in prev_credits %}
-                {{credit.points}} pynts were given by <a href="/user/view/uid={{credit.given_by.id}}">{{credit.given_by.username}}</a> to
-                <a href="/user/view/uid={{credit.given_to.id}}">{{credit.given_to.username}}</a> at {{credit.given_time.ctime}}<br />
-            {% endfor %}
-            <a href="/task/complete/tid={{task.id}}">Mark task as complete.</a>
-        {% endif %}
+        <a href="/task/view/tid={{task.id}}">Click here</a> to return to the task.<br />
 
         <form action="" method="post">
         {{form.as_p}}
         <input type="submit" value="Submit">
         </form>
+        {% if prev_credits %}
+            <a href="/task/complete/tid={{task.id}}">Mark task as complete.</a>
+            <hr />
+            <br/>Previous credits:<br />
+            {% for req in credit_requests %}
+            <hr />
+                <a href="/user/view/uid={{req.sent_by.id}}">{{req.sent_by.username}}</a> requested assigning of {{req.pynts}} pynts to
+                <a href="/user/view/uid={{req.receiving_user.id}}">{{req.receiving_user.username}}</a>
+                on {{req.creation_date|date:"D d M Y"}} at {{req.creation_date|time:"H:i"}}<br />
+                {% if req.is_replied %}
+                    status: 
+                    {% if req.reply %}
+                        Approved by <a href="/user/view/uid={{req.replied_by.id}}">{{req.replied_by.username}}</a>
+                        on {{req.reply_date|date:"D d M Y"}} at {{req.reply_date|time:"H:i"}}<br />
+                    {% else %}
+                        Rejected by <a href="/user/view/uid={{req.replied_by.id}}">{{req.replied_by.username}}</a>
+                        on {{req.reply_date|date:"D d M Y"}} at {{req.reply_date|time:"H:i"}}<br />
+                        {% if req.remarks %}
+                            Reason: {{req.remarks}}
+                        {% endif %}
+                    {% endif %}
+                {% else %}
+                    status: Request pending
+                {% endif %}
+            {% endfor %}
+        {% endif %}
 {% endblock %}