def _setup_joins(self, pieces, opts, alias):
    '\n        A helper method for get_order_by and get_distinct.\n\n        Note that get_ordering and get_distinct must produce same target\n        columns on same input, as the prefixes of get_ordering and get_distinct\n        must match. Executing SQL where this is not true is an error.\n        '
    if (not alias):
        alias = self.query.get_initial_alias()
    (field, targets, opts, joins, path) = self.query.setup_joins(pieces, opts, alias)
    alias = joins[(- 1)]
    return (field, targets, alias, joins, path, opts)
A helper method for get_order_by and get_distinct.

Note that get_ordering and get_distinct must produce same target
columns on same input, as the prefixes of get_ordering and get_distinct
must match. Executing SQL where this is not true is an error.
def _setup_joins(self, pieces, opts, alias):
    '\n        A helper method for get_order_by and get_distinct.\n\n        Note that get_ordering and get_distinct must produce same target\n        columns on same input, as the prefixes of get_ordering and get_distinct\n        must match. Executing SQL where this is not true is an error.\n        '
    if (not alias):
        alias = self.query.get_initial_alias()
    (field, targets, opts, joins, path) = self.query.setup_joins(pieces, opts, alias)
    alias = joins[(- 1)]
    return (field, targets, alias, joins, path, opts)