

def get_default_columns(self, with_aliases=False, col_aliases=None, start_alias=None, opts=None, as_pairs=False, from_parent=None):
    '\n        Computes the default columns for selecting every field in the base\n        model. Will sometimes be called to pull in related models (e.g. via\n        select_related), in which case "opts" and "start_alias" will be given\n        to provide a starting point for the traversal.\n\n        Returns a list of strings, quoted appropriately for use in SQL\n        directly, as well as a set of aliases used in the select statement (if\n        \'as_pairs\' is True, returns a list of (alias, col_name) pairs instead\n        of strings as the first component and None as the second component).\n        '
    result = []
    if (opts is None):
        opts = self.query.get_meta()
    qn = self.quote_name_unless_alias
    qn2 = self.connection.ops.quote_name
    aliases = set()
    only_load = self.deferred_to_columns()
    if (not start_alias):
        start_alias = self.query.get_initial_alias()
    seen_models = {
        None: start_alias,
    }
    for (field, model) in opts.get_concrete_fields_with_model():
        if (from_parent and (model is not None) and issubclass(from_parent, model)):
            continue
        alias = self.query.join_parent_model(opts, model, start_alias, seen_models)
        table = self.query.alias_map[alias].table_name
        if ((table in only_load) and (field.column not in only_load[table])):
            continue
        if as_pairs:
            result.append((alias, field))
            aliases.add(alias)
            continue
        if (with_aliases and (field.column in col_aliases)):
            c_alias = ('Col%d' % len(col_aliases))
            result.append(('%s.%s AS %s' % (qn(alias), qn2(field.column), c_alias)))
            col_aliases.add(c_alias)
            aliases.add(c_alias)
        else:
            r = ('%s.%s' % (qn(alias), qn2(field.column)))
            result.append(r)
            aliases.add(r)
            if with_aliases:
                col_aliases.add(field.column)
    return (result, aliases)

dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/db/models/sql/compiler.py SQLCompiler.get_default_columns/original