(opts, lookup_path)
return False
Returns True if 'distinct()' should be used to query the given lookup path.
Returns True if 'distinct()' should be used to query the given lookup path.
Returns True if distinct () should be used to query the given lookup path .
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
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