diff -r 94fe7fe7394d -r ef9fdc847543 app/projrev/views/helpers/templatetags/review_helpers.py --- a/app/projrev/views/helpers/templatetags/review_helpers.py Mon Aug 10 03:24:02 2009 +0530 +++ b/app/projrev/views/helpers/templatetags/review_helpers.py Mon Aug 10 03:54:33 2009 +0530 @@ -21,3 +21,32 @@ review.attribute7 + review.attribute8 + review.attribute9) return {'review': review, 'total_score': total_score} + +@register.inclusion_tag('projrev/templatetags/_as_my_review.html') +def as_my_review(review): + """Returns the comment contexts for the template tag. + """ + + total_score = (review.attribute1 + review.attribute2 + review.attribute3 + + review.attribute4 + review.attribute5 + review.attribute6 + + review.attribute7 + review.attribute8 + review.attribute9) + + project = review.project + proposal = project.proposal_set.all().order_by('-submitted_on')[0] + + review_context = { + 'review': review, + 'total_score': total_score, + } + + if proposal: + proposal_path = str(proposal.document) + proposal_name = proposal_path.split('/')[-1] + review_context['proposal_path'] = proposal_path + review_context['proposal_name'] = proposal_name + review_context['institution'] = project.institution + review_context['state'] = project.state + review_context['district'] = project.district + review_context['line_item'] = project.line_item + + return review_context