RepoJournal
Django

@django

Python's batteries-included web framework

Pick a date

The Wire · Showcase

DJANGO PATCHES CRITICAL QUERY ORDERING BUG AFFECTING UNIONS

By RepoJournal · Filed · About Django

Django fixed a regression in combined queries that broke ordering on union, intersection, and difference operations, potentially causing incorrect result sets in production.

The fix [1] addresses ticket #37097, a regression introduced in commit 087bb9e8f that drove traffic into an existing error path. When using union(), intersect(), or difference() operations with explicit order_by() calls, Django was failing to properly clear ordering on the inner combined queries, leading to unexpected result behavior. The team also removed redundant compilation-time order clearing on Oracle [2], which was handling the same issue inefficiently. In parallel, Django shipped a security-focused update [3] adding CSP nonce support to error pages, admin templates, and registration forms. All explicit script, link, and style elements in these templates now use the {% csp_nonce %} tag when available, hardening Django's default templates against inline script injection attacks.

Action items

References

  1. [1] Fixed #37097 -- Made Query.clear_ordering() clear ordering on combined queries also. ↗ django/django
  2. [2] Refs #37097 -- Removed compilation-time order clearing on combined queries on Oracle. django/django
  3. [3] Fixed #36825 -- Included CSP nonce in templates if available. ↗ django/django

FAQ

What changed in Django on May 19, 2026?
Django fixed a regression in combined queries that broke ordering on union, intersection, and difference operations, potentially causing incorrect result sets in production.
What should Django teams do about it?
Review any code using union/intersect/difference with order_by and test result ordering • Update to latest Django patch to get CSP nonce support in admin and error pages
Which Django repositories shipped on May 19, 2026?
django/django

Related across the cluster

For your repos

The showcase is a teaser.
Your wire is the product.

Same engine. Different stack. Below: what changes when the wire is yours.

Showcase wire

  • 14 famous open source orgs
  • One wire per day
  • Public, generic
  • Read on the web, when you remember

Your wire

  • Up to 1,500 of your repos - orgs, deps, vendors
  • Morning and evening briefs
  • Action items routed to your team
  • Slack delivery, email, breaking-news CVE alerts

Want a hands-on demo first? Ask a current user for an invite link.