Added Serial numbers support for lists.
--- a/app/projrev/views/helpers/templatetags/review_helpers.py Tue Aug 11 04:03:27 2009 +0530
+++ b/app/projrev/views/helpers/templatetags/review_helpers.py Tue Aug 11 04:34:01 2009 +0530
@@ -8,6 +8,7 @@
from django import template
+
register = template.Library()
@@ -50,3 +51,25 @@
review_context['line_item'] = project.line_item
return review_context
+
+@register.filter()
+def serial_no(project, arg):
+ """Returns the latest serial number of the project's proposal
+ """
+
+ proposals = project.proposal_set.all().order_by('-submitted_on')
+ import logging
+ logging.error(proposals)
+ if proposals:
+ if arg == 'new':
+ proposal = proposals[0]
+ elif arg == 'old':
+ if len(proposals) > 1:
+ proposal = proposals[1]
+ else:
+ proposal = None
+
+ if proposal:
+ return str(proposal.id)
+
+ return 'NA'
\ No newline at end of file
--- a/app/templates/projrev/proposal/list.html Tue Aug 11 04:03:27 2009 +0530
+++ b/app/templates/projrev/proposal/list.html Tue Aug 11 04:34:01 2009 +0530
@@ -1,24 +1,30 @@
{% extends "projrev/base.html" %}
+{% load review_helpers %}
{% block content %}
<div class="post">
<div class="list">
<table>
<tr>
- <th class="first">MICR Code</th>
+ <th class="first">Serial No.</th>
+ <th>MICR Code</th>
<th>Title</th>
<th>Line Item</th>
<th>Institution</th>
<th>State</th>
<th>District</th>
+ <th>Old Serial No.</th>
</tr>
{% for project in projects %}
<tr class="row-a"><td><a href='{{ row_url }}{{ project.micr_code }}'>
- {{ project.micr_code }}</td>
+ {{ project|serial_no:"new" }}
+ </td>
+ <td>{{ project.micr_code }}</td>
<td>{{ project.title }}</td>
<td>{{ project.line_item }}</td>
<td>{{ project.institution }}</td>
<td>{{ project.state }}</td>
<td>{{ project.district }}</td>
+ <td>{{ project|serial_no:"old" }}</td>
</a></tr>
{% endfor %}
</table>