app/projrev/views/helpers/templatetags/review_helpers.py
changeset 27 37612f295cd4
parent 26 97bd3c28c957
child 31 ef9fdc847543
equal deleted inserted replaced
26:97bd3c28c957 27:37612f295cd4
     9 from django import template
     9 from django import template
    10 
    10 
    11 register = template.Library()
    11 register = template.Library()
    12 
    12 
    13 
    13 
    14 @register.inclusion_tag('projrev/templatetags/_as_comment.html')
    14 @register.inclusion_tag('projrev/templatetags/_as_review.html')
    15 def as_comment(review):
    15 def as_review(review):
    16   """Returns the comment contexts for the template tag.
    16   """Returns the comment contexts for the template tag.
    17   """
    17   """
    18 
    18 
    19   return {'comment_entity': review}
    19   total_score = (review.attribute1 + review.attribute2 + review.attribute3 + 
       
    20                  review.attribute4 + review.attribute5 + review.attribute6 +
       
    21                  review.attribute7 + review.attribute8 + review.attribute9)
       
    22 
       
    23   return {'review': review, 'total_score': total_score}