Add support for Django 6.1, drop Django 5.1 - #247
Merged
Conversation
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.
Makes matrix drift visible in the logs rather than something you have to infer from package install churn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.1cap was conservative rather than a real incompatibility. A source audit covered the relevant 6.1 removals (staticfiles.finders.find(all=),auth.login()falling back torequest.user, theordering=parameter on the postgresArrayAgg/StringAgg/JSONBAggaggregates, andRemoteUserMiddlewaresubclassing) and found no usages. Theself.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, and5.1.15is 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>, butuv runre-syncs the environment touv.lockby 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-syncto theuv runinvocations 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.concreteisTrueon Django < 6.0 andFalsefrom 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 intest_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,OKon all three. Before thelookup_field_orderable()fix,5.2.17failed on that assertion../code_check.py --debugpasses.Notes
There is one pre-existing
RemovedInDjango70Warningfrom thesend_mail()call insmartmin/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.tomlas the source of truth.A release will be needed after this merges for downstream projects to pick up Django 6.1 support.