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, targets, u2, joins, path = self.setup_joins(
                        name.split(LOOKUP_SEP), opts, alias, None, allow_m2m,
                        allow_explicit_fk=True, outer_if_first=True)

                # Trim last join if possible
                targets, final_alias, remaining_joins = self.trim_joins(targets, joins[-2:], path)
                joins = joins[:-2] + remaining_joins

                self.promote_joins(joins[1:])
                for target in targets:
                    self.select.append(SelectInfo((final_alias, target.column), target))
        except MultiJoin:
            raise FieldError("Invalid field name: '%s'" % name)
        except FieldError:
            if LOOKUP_SEP in name:
                # For lookups spanning over relationships, show the error
                # from the model on which the lookup failed.
                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()
Get the view output. View output sorting can be controlled by passing
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/db/models/sql/query.py/Query.add_fields--crossover with--dataset/ETHPy150Open ducksboard/libsaas/libsaas/services/zendesk/resources.py/View.execute