@register.simple_tag(takes_context=False)
def display_review_request_trophies(review_request):
 trophy_models = Trophy.objects.get_trophies(review_request)
 if (not trophy_models):
  return u''
 trophies = []
 for trophy_model in trophy_models:
  trophy_type_cls = trophy_model.trophy_type
  if (trophy_type_cls is not UnknownTrophy):
   try:
    trophy_type = trophy_type_cls()
    trophies.append({u'image_urls': trophy_type.image_urls, u'image_width': trophy_type.image_width, u'image_height': trophy_type.image_height, u'name': trophy_type.name, u'text': trophy_type.get_display_text(trophy_model)})
   except Exception as e:
    logging.error(u'Error when rendering trophy %r (%r): %s', trophy_model.pk, trophy_type_cls, e, exc_info=1)
 return render_to_string(u'reviews/trophy_box.html', {u'trophies': trophies})

@ register . simple_tag ( takes_context = False ) def display_review_request_trophies ( review_request ) : trophy_models = Trophy . objects . get_trophies ( review_request ) if ( not trophy_models ) : return u'' trophies = [ ] for trophy_model in trophy_models : trophy_type_cls = trophy_model . trophy_type if ( trophy_type_cls is not UnknownTrophy ) : try : trophy_type = trophy_type_cls ( ) trophies . append ( { u'image_urls' : trophy_type . image_urls , u'image_width' : trophy_type . image_width , u'image_height' : trophy_type . image_height , u'name' : trophy_type . name , u'text' : trophy_type . get_display_text ( trophy_model ) } ) except Exception as e : logging . error ( u'Error when rendering trophy %r (%r): %s' , trophy_model . pk , trophy_type_cls , e , exc_info = 1 ) return render_to_string ( u'reviews/trophy_box.html' , { u'trophies' : trophies } )
returns the html for the trophies awarded to a review request .