def select_related_descend(field, restricted, requested, load_fields, reverse=False):
 if (not field.rel):
  return False
 if (field.rel.parent_link and (not reverse)):
  return False
 if restricted:
  if (reverse and (field.related_query_name() not in requested)):
   return False
  if ((not reverse) and (field.name not in requested)):
   return False
 if ((not restricted) and field.null):
  return False
 if load_fields:
  if (field.name not in load_fields):
   if (restricted and (field.name in requested)):
    raise InvalidQuery((u'Field %s.%s cannot be both deferred and traversed using select_related at the same time.' % (field.model._meta.object_name, field.name)))
   return False
 return True

def select_related_descend ( field , restricted , requested , load_fields , reverse = False ) : if ( not field . rel ) : return False if ( field . rel . parent_link and ( not reverse ) ) : return False if restricted : if ( reverse and ( field . related_query_name ( ) not in requested ) ) : return False if ( ( not reverse ) and ( field . name not in requested ) ) : return False if ( ( not restricted ) and field . null ) : return False if load_fields : if ( field . name not in load_fields ) : if ( restricted and ( field . name in requested ) ) : raise InvalidQuery ( ( u'Field %s.%s cannot be both deferred and traversed using select_related at the same time.' % ( field . model . _meta . object_name , field . name ) ) ) return False return True
returns true if this field should be used to descend deeper for select_related() purposes .