Drop support for Django 4.2, Django 5.0 and Django 5.1#9899
Drop support for Django 4.2, Django 5.0 and Django 5.1#9899p-r-a-v-i-n wants to merge 5 commits into
Conversation
auvipy
left a comment
There was a problem hiding this comment.
I want to wait until the release of django 6.2 LTS
Okay |
|
Since it has been developed and stabilized, isn't it a terrible idea to discontinue support immediately? :) |
|
Yes, a bit early for my taste.
I don't think we need to wait until 6.2 (that's April 2027), but we should definitely wait until 4.2 reaches EOL, which is end of April. |
|
I agree with you all here. I know this is way to early. My intention here was to make ourselves ready, to see any consequences. And once we reach at point where we are confident to drop support. We can do it without any rush. |
|
Should we drop django 5.0 and django 5.1 as they both already reached to their EOL? |
Waw I didn't realise that they were... I think that makes sense, yes. We'll probably hold off merging this PR for a little bit anyway |
eaa70e7 to
2841bf9
Compare
|
let us wait until atleast django 6.0 is released |
I assume you mean 6.1? 6.0 has been out for a while 😄 |
|
We can also simplify these as django-rest-framework/rest_framework/compat.py Lines 144 to 189 in 7f8ad25 There are a few more in the codebase |
|
There are also some leftover mentions of django-rest-framework/rest_framework/fields.py Lines 33 to 36 in 2a910c8 django-rest-framework/rest_framework/fields.py Lines 1189 to 1190 in 2a910c8 |
dfa0160 to
56f5fab
Compare
56f5fab to
cbdfc13
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates Django REST framework’s supported Django versions by dropping Django 4.2, 5.0, and 5.1, and aligns the codebase, test matrix, packaging metadata, and documentation with a new minimum of Django 5.2.
Changes:
- Update CI/test matrix and dependency groups to stop testing/installing Django 4.2/5.0/5.1.
- Raise the package minimum requirement to
django>=5.2and remove related compatibility shims. - Remove remaining pytz-specific test/doc paths and make LoginRequiredMiddleware opt-out unconditional.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tox.ini | Removes Django 4.2/5.0/5.1 envs and dependency group entries from the tox matrix. |
| pyproject.toml | Bumps minimum Django to 5.2, removes old optional Django version groups, and drops pytz from test deps. |
| rest_framework/compat.py | Deletes Django<5.1 compatibility shims (e.g., IP validator and Q referenced field helpers). |
| rest_framework/serializers.py | Switches UniqueConstraint condition field extraction to Django’s referenced_base_fields. |
| rest_framework/fields.py | Moves IP validator import to Django core; removes pytz-specific DST handling code path. |
| rest_framework/views.py | Always sets view.login_required = False (no longer version-gated). |
| rest_framework/viewsets.py | Always sets view.login_required = False (no longer version-gated). |
| tests/test_viewsets.py | Removes Django-version-gated skip; asserts login_required behavior unconditionally. |
| tests/test_views.py | Removes Django-version-gated skip; asserts login_required behavior unconditionally. |
| tests/test_middleware.py | Removes Django-version-gated skip so LoginRequiredMiddleware compatibility tests always run. |
| tests/test_fields.py | Removes pytz-based DST test class and updates timezone-related test text. |
| README.md | Updates stated supported Django versions to 5.2 and 6.0. |
| docs/index.md | Updates stated supported Django versions to 5.2 and 6.0. |
| docs/api-guide/fields.md | Updates DateTimeField.default_timezone docs to remove pytz mention. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self.fail('make_aware', timezone=field_timezone) | ||
| return dt | ||
| except Exception as e: | ||
| if pytz and isinstance(e, pytz.exceptions.InvalidTimeError): | ||
| self.fail('make_aware', timezone=field_timezone) | ||
| raise e |
There was a problem hiding this comment.
Ah, yes good point. Would you mind addressing this?
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Note: Before submitting a code change, please review our contributing guidelines.
Description
Django 4.2 will reach end of support on April 30, 2026.
I’m opening this PR early so we can have enough time to plan, communicate, and prepare for removing support.
source: https://endoflife.date/django