def s3_has_foreign_key(field, m2m=True):
 try:
  ftype = str(field.type)
 except:
  return False
 if ((ftype[:9] == 'reference') or (m2m and (ftype[:14] == 'list:reference')) or current.s3db.virtual_reference(field)):
  return True
 return False

def s3_has_foreign_key ( field , m2m = True ) : try : ftype = str ( field . type ) except : return False if ( ( ftype [ : 9 ] == 'reference' ) or ( m2m and ( ftype [ : 14 ] == 'list:reference' ) ) or current . s3db . virtual_reference ( field ) ) : return True return False
check whether a field contains a foreign key constraint .