From af7842ffd0effddd2d2438f4ac30eeb5d682bf38 Mon Sep 17 00:00:00 2001 From: nishanth Date: Sun, 28 Feb 2010 02:45:21 +0530 Subject: now view credits page shows all the credits.. including the pending and rejected ones. --- taskapp/views/task.py | 2 ++ templates/task/assigncredits.html | 37 +++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 02a6bc1..26aca14 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -435,12 +435,14 @@ def assign_credits(request, tid): 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, } diff --git a/templates/task/assigncredits.html b/templates/task/assigncredits.html index 9c64cae..066505d 100644 --- a/templates/task/assigncredits.html +++ b/templates/task/assigncredits.html @@ -3,19 +3,36 @@ {{task.title}} {% endblock %} {% block content %} - Click here to return to the task. - {% if prev_credits %} -
-
Previous credits:
- {% for credit in prev_credits %} - {{credit.points}} pynts were given by {{credit.given_by.username}} to - {{credit.given_to.username}} at {{credit.given_time.ctime}}
- {% endfor %} - Mark task as complete. - {% endif %} + Click here to return to the task.
{{form.as_p}}
+ {% if prev_credits %} + Mark task as complete. +
+
Previous credits:
+ {% for req in credit_requests %} +
+ {{req.sent_by.username}} requested assigning of {{req.pynts}} pynts to + {{req.receiving_user.username}} + on {{req.creation_date|date:"D d M Y"}} at {{req.creation_date|time:"H:i"}}
+ {% if req.is_replied %} + status: + {% if req.reply %} + Approved by {{req.replied_by.username}} + on {{req.reply_date|date:"D d M Y"}} at {{req.reply_date|time:"H:i"}}
+ {% else %} + Rejected by {{req.replied_by.username}} + on {{req.reply_date|date:"D d M Y"}} at {{req.reply_date|time:"H:i"}}
+ {% if req.remarks %} + Reason: {{req.remarks}} + {% endif %} + {% endif %} + {% else %} + status: Request pending + {% endif %} + {% endfor %} + {% endif %} {% endblock %} -- cgit