Add comparison of OrderBy with nulls_first/nulls_last.
Review Request #15276 — Created Sept. 6, 2026 and updated — Latest diff uploaded
Internally, Django represents an
order_byclause with anOrderBy
instance, and this can containnulls_first=andnulls_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_byto
both show anynulls_*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.