#NEWLINE# def validate_local_fields( e , opts , field_name , fields ) : #NEWLINE# #INDENT# from django.db import models #NEWLINE# if ( not isinstance ( fields , collections . Sequence ) ) : #NEWLINE# #INDENT# e . add ( opts , ( 'all %s elements must be sequences' % field_name ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# for field in fields : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# f = opts . get_field ( field , many_to_many = True ) #NEWLINE# #UNINDENT# except models . FieldDoesNotExist : #NEWLINE# #INDENT# e . add ( opts , ( '"%s" refers to %s, a field that doesn\'t exist.' % ( field_name , field ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( f . rel , models . ManyToManyRel ) : #NEWLINE# #INDENT# e . add ( opts , ( '"%s" refers to %s. ManyToManyFields are not supported in %s.' % ( field_name , f . name , field_name ) ) ) #NEWLINE# #UNINDENT# if ( f not in opts . local_fields ) : #NEWLINE# #INDENT# e . add ( opts , ( '"%s" refers to %s. This is not in the same model as the %s statement.' % ( field_name , f . name , field_name ) ) )