• 
      

    Add comparison of OrderBy with nulls_first/nulls_last.

    Review Request #15276 — Created Sept. 6, 2026 and updated

    Information

    django-assert-queries
    main

    Reviewers

    Internally, Django represents an order_by clause with an OrderBy
    instance, and this can contain nulls_first= and nulls_last=
    settings. These settings affect comparisons, but don't show up in the
    repr() output, making it hard to debug. They can also support
    subqueries, which need to be handled just like we do for other clauses.

    This change adds explicit comparisons and formatting for order_by to
    both show any nulls_* attributes and to store subquery information for
    comparison when in use by the query.

    All unit tests pass in all test environments.

    Review Board and Djblets unit tests pass.

    Summary ID
    Add comparison of OrderBy with nulls_first/nulls_last.
    Internally, Django represents an `order_by` clause with an `OrderBy` instance, and this can contain `nulls_first=` and `nulls_last=` settings. These settings affect comparisons, but don't show up in the `repr()` output, making it hard to debug. They can also support subqueries, which need to be handled just like we do for other clauses. This change adds explicit comparisons and formatting for `order_by` to both show any `nulls_*` attributes and to store subquery information for comparison when in use by the query.
    9dc0797ad9e0f034bf7e1de26829fed1722c10fa
    Checks run (2 succeeded)
    flake8 passed.
    JSHint passed.