'Adds the given (model) fields to the select set. The field names are
added in the order specified.'

def add_fields(self, field_names, allow_m2m=True):

    alias = self.get_initial_alias()
    opts = self.get_meta()
    try:
        for name in field_names:
            (field, target, u2, joins, u3, u4) = self.setup_joins(name.split(LOOKUP_SEP), opts, alias, False, allow_m2m, True)
            final_alias = joins[(-1)]
            col = target.column
            if (len(joins) > 1):
                join = self.alias_map[final_alias]
                if (col == join.rhs_join_col):
                    self.unref_alias(final_alias)
                    final_alias = join.lhs_alias
                    col = join.lhs_join_col
                    joins = joins[:(-1)]
            self.promote_joins(joins[1:])
            self.select.append((final_alias, col))
            self.select_fields.append(field)
    except MultiJoin:
        raise FieldError(("Invalid    field    name:    '%s'" % name))
    except FieldError:
        if (LOOKUP_SEP in name):
            raise
        else:
            names = sorted(((opts.get_all_field_names() + list(self.extra)) + list(self.aggregate_select)))
            raise FieldError(('Cannot    resolve    keyword    %r    into    field.    Choices    are:    %s' % (name, ',    '.join(names))))
    self.remove_inherited_models()
