#NEWLINE# def _check_related_name_is_valid( self ) : #NEWLINE# #INDENT# import re #NEWLINE# import keyword #NEWLINE# related_name = self . remote_field . related_name #NEWLINE# if ( related_name is None ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# is_valid_id = True #NEWLINE# if keyword . iskeyword ( related_name ) : #NEWLINE# #INDENT# is_valid_id = False #NEWLINE# #UNINDENT# if six . PY3 : #NEWLINE# #INDENT# if ( not related_name . isidentifier ( ) ) : #NEWLINE# #INDENT# is_valid_id = False #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( not re . match ( '^[a-zA-Z_][a-zA-Z0-9_]*\\Z' , related_name ) ) : #NEWLINE# #INDENT# is_valid_id = False #NEWLINE# #UNINDENT# #UNINDENT# if ( not ( is_valid_id or related_name . endswith ( '+' ) ) ) : #NEWLINE# #INDENT# return [ checks . Error ( ( "The name '%s' is invalid related_name for field %s.%s" % ( self . remote_field . related_name , self . model . _meta . object_name , related_name . name ) ) , hint = "Related name must be a valid Python identifier or end with a '+'" , obj = self , id = 'fields.E306' ) ] #NEWLINE# #UNINDENT# return [ ]