Skip to content

Commit eaa70e7

Browse files
committed
Drop support for Django 4.2
1 parent 64bee7f commit eaa70e7

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
@@ -61,7 +61,7 @@ Some reasons you might want to use REST framework:
6161

6262
REST framework requires the following:
6363

64-
* Django (4.2, 5.0, 5.1, 5.2)
64+
* Django (5.0, 5.1, 5.2)
6565
* Python (3.10, 3.11, 3.12, 3.13, 3.14)
6666

6767
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.
@@ -75,7 +72,6 @@ optional = [
7572
# setuptools is needed for coreapi (imports pkg_resources)
7673
"setuptools<82",
7774
]
78-
django42 = [ "django>=4.2,<5.0" ]
7975
django50 = [ "django>=5.0,<5.1" ]
8076
django51 = [ "django>=5.1,<5.2" ]
8177
django52 = [ "django>=5.2,<6.0" ]
@@ -102,7 +98,7 @@ skip = [ ".tox" ]
10298
atomic = true
10399
multi_line_output = 5
104100
extra_standard_library = [ "types" ]
105-
known_third_party = [ "pytest", "_pytest", "django", "pytz", "uritemplate" ]
101+
known_third_party = [ "pytest", "_pytest", "django", "uritemplate" ]
106102
known_first_party = [ "rest_framework", "tests" ]
107103

108104
[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
@@ -1646,7 +1644,7 @@ def setup_class(cls):
16461644

16471645
def assertUTC(self, tzinfo):
16481646
"""
1649-
Check UTC for datetime.timezone, ZoneInfo, and pytz tzinfo instances.
1647+
Check UTC for datetime.timezone, ZoneInfo.
16501648
"""
16511649
assert (
16521650
tzinfo is utc or
@@ -1684,34 +1682,6 @@ def test_should_render_date_time_in_default_timezone(self):
16841682
assert rendered_date == rendered_date_in_timezone
16851683

16861684

1687-
@pytest.mark.skipif(
1688-
condition=django.VERSION >= (5,),
1689-
reason="Django 5.0 has removed pytz; this test should eventually be able to get removed.",
1690-
)
1691-
class TestPytzNaiveDayLightSavingTimeTimeZoneDateTimeField(FieldValues):
1692-
"""
1693-
Invalid values for `DateTimeField` with datetime in DST shift (non-existing or ambiguous) and timezone with DST.
1694-
Timezone America/New_York has DST shift from 2017-03-12T02:00:00 to 2017-03-12T03:00:00 and
1695-
from 2017-11-05T02:00:00 to 2017-11-05T01:00:00 in 2017.
1696-
"""
1697-
valid_inputs = {}
1698-
invalid_inputs = {
1699-
'2017-03-12T02:30:00': ['Invalid datetime for the timezone "America/New_York".'],
1700-
'2017-11-05T01:30:00': ['Invalid datetime for the timezone "America/New_York".']
1701-
}
1702-
outputs = {}
1703-
1704-
class MockTimezone(pytz.BaseTzInfo):
1705-
@staticmethod
1706-
def localize(value, is_dst):
1707-
raise pytz.InvalidTimeError()
1708-
1709-
def __str__(self):
1710-
return 'America/New_York'
1711-
1712-
field = serializers.DateTimeField(default_timezone=MockTimezone())
1713-
1714-
17151685
@patch('rest_framework.utils.timezone.datetime_ambiguous', return_value=True)
17161686
class TestNaiveDayLightSavingTimeTimeZoneDateTimeField(FieldValues):
17171687
"""

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)