<s> from __future__ import unicode_literals <EOL> from mezzanine import template <EOL> from mezzanine . generic . forms import RatingForm <EOL> register = template . Library ( ) <EOL> @ register . inclusion_tag ( "<STR_LIT>" , takes_context = True ) <EOL> def rating_for ( context , obj ) : <EOL> """<STR_LIT>""" <EOL> context [ "<STR_LIT>" ] = context [ "<STR_LIT>" ] = obj <EOL> context [ "<STR_LIT>" ] = RatingForm ( context [ "<STR_LIT>" ] , obj ) <EOL> ratings = context [ "<STR_LIT>" ] . COOKIES . get ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> rating_string = "<STR_LIT>" % ( obj . _meta , obj . pk ) <EOL> context [ "<STR_LIT>" ] = ( rating_string in ratings ) <EOL> rating_name = obj . get_ratingfield_name ( ) <EOL> for f in ( "<STR_LIT>" , "<STR_LIT:count>" , "<STR_LIT>" ) : <EOL> context [ "<STR_LIT>" + f ] = getattr ( obj , "<STR_LIT>" % ( rating_name , f ) ) <EOL> return context </s>
