Skip to content

Commit 4c46560

Browse files
committed
Drop support for Django 4.2
1 parent 67fea6a commit 4c46560

6 files changed

Lines changed: 9 additions & 44 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Some reasons you might want to use REST framework:
3131
# Requirements
3232

3333
* Python 3.10+
34-
* Django 4.2, 5.0, 5.1, 5.2, 6.0
34+
* Django 5.0, 5.1, 5.2, 6.0
3535

3636
We **highly recommend** and only officially support the latest patch release of
3737
each Python and Django series.

docs/api-guide/fields.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ Corresponds to `django.db.models.fields.DateTimeField`.
330330

331331
* `format` - A string representing the output format. If not specified, this defaults to the same value as the `DATETIME_FORMAT` settings key, which will be `'iso-8601'` unless set. Setting to a format string indicates that `to_representation` return values should be coerced to string output. Format strings are described below. Setting this value to `None` indicates that Python `datetime` objects should be returned by `to_representation`. In this case the datetime encoding will be determined by the renderer.
332332
* `input_formats` - A list of strings representing the input formats which may be used to parse the date. If not specified, the `DATETIME_INPUT_FORMATS` setting will be used, which defaults to `['iso-8601']`.
333-
* `default_timezone` - A `tzinfo` subclass (`zoneinfo` or `pytz`) representing the timezone. If not specified and the `USE_TZ` setting is enabled, this defaults to the [current timezone][django-current-timezone]. If `USE_TZ` is disabled, then datetime objects will be naive.
333+
* `default_timezone` - A `tzinfo` subclass (`zoneinfo`) representing the timezone. If not specified and the `USE_TZ` setting is enabled, this defaults to the [current timezone][django-current-timezone]. If `USE_TZ` is disabled, then datetime objects will be naive.
334334

335335
#### `DateTimeField` format strings.
336336

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Some reasons you might want to use REST framework:
6565

6666
REST framework requires the following:
6767

68-
* Django (4.2, 5.0, 5.1, 5.2, 6.0)
68+
* Django (5.0, 5.1, 5.2, 6.0)
6969
* Python (3.10, 3.11, 3.12, 3.13, 3.14)
7070

7171
We **highly recommend** and only officially support the latest patch release of

pyproject.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ classifiers = [
1414
"Development Status :: 5 - Production/Stable",
1515
"Environment :: Web Environment",
1616
"Framework :: Django",
17-
"Framework :: Django :: 4.2",
1817
"Framework :: Django :: 5.0",
1918
"Framework :: Django :: 5.1",
2019
"Framework :: Django :: 5.2",
@@ -31,7 +30,7 @@ classifiers = [
3130
"Topic :: Internet :: WWW/HTTP",
3231
]
3332
dynamic = [ "version" ]
34-
dependencies = [ "django>=4.2" ]
33+
dependencies = [ "django>=5.0" ]
3534
urls.Changelog = "https://www.django-rest-framework.org/community/release-notes/"
3635
urls.Funding = "https://fund.django-rest-framework.org/topics/funding/"
3736
urls.Homepage = "https://www.django-rest-framework.org"
@@ -51,8 +50,6 @@ test = [
5150
"pytest-cov==7.*",
5251
"pytest-django>=4.5.2,<5",
5352

54-
# Remove when dropping support for Django<5.0
55-
"pytz",
5653
]
5754
docs = [
5855
# MkDocs to build our documentation.
@@ -74,7 +71,6 @@ optional = [
7471
"requests",
7572
"uritemplate",
7673
]
77-
django42 = [ "django>=4.2,<5.0" ]
7874
django50 = [ "django>=5.0,<5.1" ]
7975
django51 = [ "django>=5.1,<5.2" ]
8076
django52 = [ "django>=5.2,<6.0" ]
@@ -101,7 +97,7 @@ skip = [ ".tox" ]
10197
atomic = true
10298
multi_line_output = 5
10399
extra_standard_library = [ "types" ]
104-
known_third_party = [ "pytest", "_pytest", "django", "pytz", "uritemplate" ]
100+
known_third_party = [ "pytest", "_pytest", "django", "uritemplate" ]
105101
known_first_party = [ "rest_framework", "tests" ]
106102

107103
[tool.codespell]

tests/test_fields.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
from unittest.mock import patch
1010
from zoneinfo import ZoneInfo
1111

12-
import django
1312
import pytest
14-
import pytz
1513
from django.core.exceptions import ValidationError as DjangoValidationError
1614
from django.db.models import IntegerChoices, TextChoices
1715
from django.http import QueryDict
@@ -1708,7 +1706,7 @@ def setup_class(cls):
17081706

17091707
def assertUTC(self, tzinfo):
17101708
"""
1711-
Check UTC for datetime.timezone, ZoneInfo, and pytz tzinfo instances.
1709+
Check UTC for datetime.timezone, ZoneInfo.
17121710
"""
17131711
assert (
17141712
tzinfo is utc or
@@ -1746,34 +1744,6 @@ def test_should_render_date_time_in_default_timezone(self):
17461744
assert rendered_date == rendered_date_in_timezone
17471745

17481746

1749-
@pytest.mark.skipif(
1750-
condition=django.VERSION >= (5,),
1751-
reason="Django 5.0 has removed pytz; this test should eventually be able to get removed.",
1752-
)
1753-
class TestPytzNaiveDayLightSavingTimeTimeZoneDateTimeField(FieldValues):
1754-
"""
1755-
Invalid values for `DateTimeField` with datetime in DST shift (non-existing or ambiguous) and timezone with DST.
1756-
Timezone America/New_York has DST shift from 2017-03-12T02:00:00 to 2017-03-12T03:00:00 and
1757-
from 2017-11-05T02:00:00 to 2017-11-05T01:00:00 in 2017.
1758-
"""
1759-
valid_inputs = {}
1760-
invalid_inputs = {
1761-
'2017-03-12T02:30:00': ['Invalid datetime for the timezone "America/New_York".'],
1762-
'2017-11-05T01:30:00': ['Invalid datetime for the timezone "America/New_York".']
1763-
}
1764-
outputs = {}
1765-
1766-
class MockTimezone(pytz.BaseTzInfo):
1767-
@staticmethod
1768-
def localize(value, is_dst):
1769-
raise pytz.InvalidTimeError()
1770-
1771-
def __str__(self):
1772-
return 'America/New_York'
1773-
1774-
field = serializers.DateTimeField(default_timezone=MockTimezone())
1775-
1776-
17771747
@patch('rest_framework.utils.timezone.datetime_ambiguous', return_value=True)
17781748
class TestNaiveDayLightSavingTimeTimeZoneDateTimeField(FieldValues):
17791749
"""

tox.ini

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[tox]
22
envlist =
3-
{py310}-{django42,django51,django52}
4-
{py311}-{django42,django51,django52}
5-
{py312}-{django42,django51,django52,django60,djangomain}
3+
{py310}-{django51,django52}
4+
{py311}-{django51,django52}
5+
{py312}-{django51,django52,django60,djangomain}
66
{py313}-{django51,django52,django60,djangomain}
77
{py314}-{django52,django60,djangomain}
88
base
@@ -18,7 +18,6 @@ setenv =
1818
dependency_groups =
1919
test
2020
optional
21-
django42: django42
2221
django50: django50
2322
django51: django51
2423
django52: django52

0 commit comments

Comments
 (0)