Skip to content

Add support for Django 6.1, drop Django 5.1 - #247

Merged
rowanseymour merged 3 commits into
mainfrom
rowan/objective-cannon-d30296
Aug 21, 2026
Merged

Add support for Django 6.1, drop Django 5.1#247
rowanseymour merged 3 commits into
mainfrom
rowan/objective-cannon-d30296

Conversation

@rowanseymour

@rowanseymour rowanseymour commented Aug 21, 2026

Copy link
Copy Markdown
Member

Adds support for Django 6.1, drops Django 5.1, and fixes the CI matrix so it actually tests what it claims to.

Django 6.1 support

The previous <6.1 cap was conservative rather than a real incompatibility. A source audit covered the relevant 6.1 removals (staticfiles.finders.find(all=), auth.login() falling back to request.user, the ordering= parameter on the postgres ArrayAgg/StringAgg/JSONBAgg aggregates, and RemoteUserMiddleware subclassing) and found no usages. The self.client.login(username=..., password=...) calls in the test suite are the test client's login helper, which is unaffected.

No CI service change was needed — the workflow already runs postgres:15-alpine, which satisfies Django 6.1's new PostgreSQL 15+ minimum.

Dropping Django 5.1

The supported range is now >=5.2.17,<6.2, and 5.1.15 is gone from the CI matrix. The existing matrix entries were also refreshed to current patch releases (5.2.12 -> 5.2.17, 6.0.3 -> 6.0.8).

There was no version-conditional code or compatibility shim anywhere in the codebase, so dropping 5.1 wasn't unblocking anything that had been worked around.

Making the CI matrix effective

While verifying the above, the matrix turned out to have never taken effect. The workflow installs the matrix version with uv pip install django~=<version>, but uv run re-syncs the environment to uv.lock by default, which uninstalled that version and restored the locked one before any test ran. Every leg was therefore testing the locked Django, and the matrix was decorative.

Passing --no-sync to the uv run invocations fixes this, so a leg now genuinely runs its matrix version.

Resulting fix to lookup_field_orderable()

With the matrix actually taking effect, a real cross-version difference surfaced: ManyToManyField.concrete is True on Django < 6.0 and False from 6.0 onwards. lookup_field_orderable() returned that attribute directly, so on 5.2 it reported m2m fields as orderable — contradicting its own docstring, and offering a sort that would require row-duplicating joins. It now excludes m2m fields explicitly, which behaves consistently on every supported version. This was already covered by an existing assertion in test_list, which had been silently passing only because the matrix wasn't working.

Verification

The full suite was run locally against each matrix version in turn (5.2.17, 6.0.8, 6.1), with the environment pinned so the version under test was the one actually loaded: 49 tests, OK on all three. Before the lookup_field_orderable() fix, 5.2.17 failed on that assertion. ./code_check.py --debug passes.

Notes

There is one pre-existing RemovedInDjango70Warning from the send_mail() call in smartmin/users/views.py, tripped by the new MAILERS deprecation. That's a 7.0 concern and doesn't affect 6.1, so it's deliberately left untouched.

The README's "About Versions" section stated a supported range that had gone stale several releases ago. Rather than restate a range that has to be updated by hand each time, it now points at pyproject.toml as the source of truth.

A release will be needed after this merges for downstream projects to pick up Django 6.1 support.

The CI matrix installed the matrix Django version with `uv pip install`, but
the subsequent `uv run` invocations re-synced the environment back to the
locked version, so every leg was actually testing the locked Django rather
than its matrix version. Pass --no-sync so the installed version survives.

With the matrix actually taking effect, `lookup_field_orderable()` was
returning True for m2m fields on Django < 6.0, where such fields still report
themselves as concrete. Exclude m2m fields explicitly so the behaviour matches
the documented intent on every supported version.
@rowanseymour rowanseymour changed the title Add support for Django 6.1 Add support for Django 6.1, drop Django 5.1 Aug 21, 2026
Makes matrix drift visible in the logs rather than something you have to
infer from package install churn.
@rowanseymour
rowanseymour merged commit 75bac10 into main Aug 21, 2026
22 checks passed
@rowanseymour
rowanseymour deleted the rowan/objective-cannon-d30296 branch August 21, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant