(self, aliases)
Order the data based on order by aliases (prefixed column names) in the
        table.

        Arguments:
            aliases (`~.utils.OrderByTuple`): optionally prefixed names of
                columns ('-' indicates descending order) in order of
                significance with regard to data ordering.
Order the data based on order by aliases (prefixed column names) in the
        table.
Order the data based on order by aliases ( prefixed column names ) in the table .
def order_by(self, aliases):
        """
        Order the data based on order by aliases (prefixed column names) in the
        table.

        Arguments:
            aliases (`~.utils.OrderByTuple`): optionally prefixed names of
                columns ('-' indicates descending order) in order of
                significance with regard to data ordering.
        """
        modified_any = False
        accessors = []
        for alias in aliases:
            bound_column = self.table.columns[OrderBy(alias).bare]
            # bound_column.order_by reflects the current ordering applied to
            # the table. As such we need to check the current ordering on the
            # column and use the opposite if it doesn't match the alias prefix.
            if alias[0] != bound_column.order_by_alias[0]:
                accessors += bound_column.order_by.opposite
            else:
                accessors += bound_column.order_by

            if bound_column:
                queryset, modified = bound_column.order(self.data, alias[0] == "-")

                if modified:
                    self.data = queryset
                    modified_any = True

        # custom ordering
        if modified_any:
            return

        # Traditional ordering
        if accessors:
            order_by_accessors = (a.for_queryset() for a in accessors)
            self.data = self.data.order_by(*order_by_accessors)
def order_by ( self , aliases ) : modified_any = False accessors = [ ] for alias in aliases : bound_column = self . table . columns [ OrderBy ( alias ) . bare ] # bound_column.order_by reflects the current ordering applied to # the table. As such we need to check the current ordering on the # column and use the opposite if it doesn't match the alias prefix. if alias [ 0 ] != bound_column . order_by_alias [ 0 ] : accessors += bound_column . order_by . opposite else : accessors += bound_column . order_by if bound_column : queryset , modified = bound_column . order ( self . data , alias [ 0 ] == "-" ) if modified : self . data = queryset modified_any = True # custom ordering if modified_any : return # Traditional ordering if accessors : order_by_accessors = ( a . for_queryset ( ) for a in accessors ) self . data = self . data . order_by ( * order_by_accessors )