#NEWLINE# def fetch_attr( cls , model , opts , label , field ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return opts . get_field ( field ) #NEWLINE# #UNINDENT# except models . FieldDoesNotExist : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# return getattr ( model , field ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# raise ImproperlyConfigured ( ( "'%s.%s' refers to '%s' that is neither a field, method or property of model '%s'." % ( cls . __name__ , label , field , model . __name__ ) ) )