code: def _orderby_sql(self, quote_char=None, **kwargs):
          
          clauses = []
          selected_aliases = {s.alias for s in self.base_query._selects}
          for field, directionality in self._orderbys:
              term = "{quote}{alias}{quote}".format(alias=field.alias, quote=quote_char or '') \
                  if field.alias and field.alias in selected_aliases \
                  else field.get_sql(quote_char=quote_char, **kwargs)
  
              clauses.append('{term} {orient}'.format(term=term, orient=directionality.value)
                             if directionality is not None else term)
  
          return ' ORDER BY {orderby}'.format(orderby=','.join(clauses))
docs: Produces the ORDER BY part of the query.  This is a list of fields and possibly their directionality, ASC or
          DESC. The clauses are stored in the query under self._orderbys as a list of tuples containing the field and
          directionality (which can be None).
  
          If an order by field is used in the select clause, determined by a matching , then the ORDER BY clause will use
          the alias, otherwise the field will be rendered as SQL.