#NEWLINE# @ register . filter #NEWLINE# def rating_score( obj , user ) : #NEWLINE# #INDENT# '\n    Returns the score a user has given an object\n    ' #NEWLINE# if ( ( not user . is_authenticated ( ) ) or ( not hasattr ( obj , '_ratings_field' ) ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# ratings_descriptor = getattr ( obj , rating . _ratings_field ) #NEWLINE# try : #NEWLINE# #INDENT# rating = ratings_descriptor . get ( user = user ) . score #NEWLINE# #UNINDENT# except ratings_descriptor . model . DoesNotExist : #NEWLINE# #INDENT# rating = None #NEWLINE# #UNINDENT# return rating