parameters: (opts, lookup_path)
return_statement: return False
docstring: Returns True if 'distinct()' should be used to query the given lookup path.
docstring_summary: Returns True if 'distinct()' should be used to query the given lookup path.
docstring_tokens: Returns True if distinct () should be used to query the given lookup path .
function: def lookup_needs_distinct(opts, lookup_path):
      """
      Returns True if 'distinct()' should be used to query the given lookup path.
      """
      field_name = lookup_path.split('__', 1)[0]
      field = opts.get_field(field_name)
      if ((hasattr(field, 'rel') and
           isinstance(field.rel, models.ManyToManyRel)) or
          (is_related_field(field) and
           not field.field.unique)):
          return True
      return False
function_tokens: def lookup_needs_distinct ( opts , lookup_path ) : field_name = lookup_path . split ( '__' , 1 ) [ 0 ] field = opts . get_field ( field_name ) if ( ( hasattr ( field , 'rel' ) and isinstance ( field . rel , models . ManyToManyRel ) ) or ( is_related_field ( field ) and not field . field . unique ) ) : return True return False