                      order_by.append((OrderBy(F(col), descending=descending), False))
                  else:
                      # 'col' is of the form 'field' or 'field1__field2' or
                      # '-field1__field2__field', etc.
                      order_by.extend(self.find_ordering_name(
                          field, self.query.get_meta(), default_order=asc,
                      ))
              else:
                  if col not in self.query.extra_select:
                      order_by.append((
                          OrderBy(RawSQL(*self.query.extra[col]), descending=descending),
                          False))
                  else:
                      order_by.append((
                          OrderBy(Ref(col, RawSQL(*self.query.extra[col])), descending=descending),
                          True))
          result = []
          seen = set()
  
          for expr, is_ref in order_by:
              resolved = expr.resolve_expression(self.query, allow_joins=True, reuse=None)
 
</s> remove                     order_by.append((OrderBy(F(col), descending=descending), False))
 </s> add                     yield OrderBy(F(col), descending=descending), False </s> remove         for expr, is_ref in order_by:
 </s> add         for expr, is_ref in self._order_by_pairs():
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                      order_by.append((OrderBy(F(col), descending=descending), False))
                  else:
                      # 'col' is of the form 'field' or 'field1__field2' or
                      # '-field1__field2__field', etc.
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
                    yield from self.find_ordering_name(
                        field, self.query.get_meta(), default_order=default_order,
                    )

    def get_order_by(self):
        """
        Return a list of 2-tuples of the form (expr, (sql, params, is_ref)) for
        the ORDER BY clause.

        The order_by clause can alter the select clause (for example it can add
        aliases to clauses that do not yet have one, or it can add totally new
        select clauses).
        """
          result = []
          seen = set()
  
          for expr, is_ref in order_by:
              resolved = expr.resolve_expression(self.query, allow_joins=True, reuse=None)
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Fixed #32662 -- Refactored a generator out of SQLCompiler.get_order_by().

This also renames the `asc` variable to `default_order`, markes the
`desc` variable as unused, fixes a typo in SQLCompiler.get_order_by()
docstring, and reorders some blocks in SQLCompiler._order_by_pairs(). 
django/db/models/sql/compiler.py