# HG changeset patch # User Madhusudan.C.S # Date 1249595204 -19800 # Node ID 9d720dfded680cce2e0434898a209230a4c142eb # Parent 68454071934449b7087f7207fbac3f835aedf999 Footer for reviews. diff -r 684540719344 -r 9d720dfded68 app/projrev/views/proposal.py --- a/app/projrev/views/proposal.py Fri Aug 07 03:04:57 2009 +0530 +++ b/app/projrev/views/proposal.py Fri Aug 07 03:16:44 2009 +0530 @@ -157,7 +157,7 @@ context['proposal_path'] = proposal_path context['proposal_name'] = proposal_name - context['last_submitted'] = proposal.submitted_on + context['last_submitted'] = proposal.submitted_on if 'HTTP_REFERER' in request.META: referer = request.META['HTTP_REFERER'].split('/') @@ -236,30 +236,37 @@ """ """ + context = {} + if not micr_code: template = 'projrev/proposal/list.html' - context = { - 'projects': Project.objects.all().exclude(status__exact='invalid'), - 'row_url': '/proposal/review/', - } + context['projects'] = Project.objects.all().exclude(status__exact='invalid') + context['row_url'] = '/proposal/review/' return render_to_response(template, RequestContext(request, context)) if not rev_form: rev_form = projrev_forms.ReviewForm() - proposal_path = str(Project.objects.get( - micr_code=micr_code).proposal_set.all().order_by( - '-submitted_on')[0].document) + project = Project.objects.get(micr_code=micr_code) + context['form'] = rev_form + context['project'] = project - proposal_name = proposal_path.split('/')[-1] + proposal = project.proposal_set.all().order_by('-submitted_on')[0] + + if proposal: + proposal_path = str(proposal.document) - context = { - 'form': rev_form, - 'project': Project.objects.get(micr_code=micr_code), - 'proposal_path': proposal_path, - 'proposal_name': proposal_name, - } + proposal_name = proposal_path.split('/')[-1] + + context['proposal_path'] = proposal_path + context['proposal_name'] = proposal_name + context['last_submitted'] = proposal.submitted_on + + reviews = project.review_set.all().order_by('-reviewed_on') + if reviews: + context['last_reviewed'] = reviews[0].reviewed_on + context['nr_reviews'] = len(reviews) template = 'projrev/proposal/review.html' diff -r 684540719344 -r 9d720dfded68 app/templates/projrev/proposal/review.html --- a/app/templates/projrev/proposal/review.html Fri Aug 07 03:04:57 2009 +0530 +++ b/app/templates/projrev/proposal/review.html Fri Aug 07 03:16:44 2009 +0530 @@ -55,14 +55,32 @@ {{ form.as_p }}
-

+

-

- Reviews (5) - Last reviewed: Nov 11, 2006 - Last submitted: Nov 11, 2006 -

+

+ Reviews: + {% if nr_reviews %} + {{ nr_reviews }} + {% else %} + (None) + {% endif %} + + Last reviewed: + {% if last_reviewed %} + {{ last_reviewed|date:"jS F Y h:iA" }} + {% else %} + (Not Reviewed) + {% endif %} + + Last submitted: + {% if last_submitted %} + {{ last_submitted|date:"jS F Y h:iA" }} + {% else %} + (New Submission) + {% endif %} + +

{% endblock content %} \ No newline at end of file diff -r 684540719344 -r 9d720dfded68 app/templates/projrev/proposal/submit.html --- a/app/templates/projrev/proposal/submit.html Fri Aug 07 03:04:57 2009 +0530 +++ b/app/templates/projrev/proposal/submit.html Fri Aug 07 03:16:44 2009 +0530 @@ -43,14 +43,14 @@ Last reviewed: {% if last_reviewed %} - {{ last_reviewed|date:"jS F Y H:i" }} + {{ last_reviewed|date:"jS F Y h:iA" }} {% else %} (Not Reviewed) {% endif %} Last submitted: {% if last_submitted %} - {{ last_submitted|date:"jS F Y H:i" }} + {{ last_submitted|date:"jS F Y h:iA" }} {% else %} (New Submission) {% endif %}