From 72905462c9a316baf64f64b76823c962553159bf Mon Sep 17 00:00:00 2001 From: Oliver Sauder Date: Thu, 18 Nov 2021 22:07:00 +0400 Subject: [PATCH 1/2] Added support for Django 4.0 --- CHANGELOG.md | 4 ++++ README.rst | 2 +- docs/getting-started.md | 2 +- example/settings/dev.py | 1 + example/urls_test.py | 2 +- requirements/requirements-optionals.txt | 2 +- requirements/requirements-testing.txt | 5 +++++ setup.cfg | 4 ++-- setup.py | 2 +- tests/test_relations.py | 2 +- tox.ini | 2 ++ 11 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b631eda7..18ca7b03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,10 @@ any parts of the framework not mentioned in the documentation should generally b ## [Unreleased] +### Added + +* Added support for Django 4.0. + ### Fixed * Adjusted error messages to correctly use capital "JSON:API" abbreviation as used in the specification. diff --git a/README.rst b/README.rst index c3e661e3..b3f4ad35 100644 --- a/README.rst +++ b/README.rst @@ -89,7 +89,7 @@ Requirements ------------ 1. Python (3.6, 3.7, 3.8, 3.9) -2. Django (2.2, 3.0, 3.1, 3.2) +2. Django (2.2, 3.0, 3.1, 3.2, 4.0) 3. Django REST framework (3.12) We **highly** recommend and only officially support the latest patch release of each Python, Django and REST framework series. diff --git a/docs/getting-started.md b/docs/getting-started.md index 51780af2..0d0d0caf 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -52,7 +52,7 @@ like the following: ## Requirements 1. Python (3.6, 3.7, 3.8, 3.9) -2. Django (2.2, 3.0, 3.1, 3.2) +2. Django (2.2, 3.0, 3.1, 3.2, 4.0) 3. Django REST framework (3.12) We **highly** recommend and only officially support the latest patch release of each Python, Django and REST framework series. diff --git a/example/settings/dev.py b/example/settings/dev.py index 12bed35c..c02180eb 100644 --- a/example/settings/dev.py +++ b/example/settings/dev.py @@ -5,6 +5,7 @@ MEDIA_ROOT = os.path.normcase(os.path.dirname(os.path.abspath(__file__))) MEDIA_URL = "/media/" +USE_TZ = False DATABASE_ENGINE = "sqlite3" diff --git a/example/urls_test.py b/example/urls_test.py index 5ee06a23..92802a81 100644 --- a/example/urls_test.py +++ b/example/urls_test.py @@ -1,4 +1,4 @@ -from django.conf.urls import re_path +from django.urls import re_path from rest_framework import routers from .api.resources.identity import GenericIdentity, Identity diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index 1db26c07..0fcfcbbf 100644 --- a/requirements/requirements-optionals.txt +++ b/requirements/requirements-optionals.txt @@ -1,4 +1,4 @@ django-filter==21.1 -django-polymorphic==3.0.0 +django-polymorphic==3.1.0 pyyaml==6.0 uritemplate==4.1.1 diff --git a/requirements/requirements-testing.txt b/requirements/requirements-testing.txt index 4d83cd28..415e4124 100644 --- a/requirements/requirements-testing.txt +++ b/requirements/requirements-testing.txt @@ -6,3 +6,8 @@ pytest-cov==3.0.0 pytest-django==4.4.0 pytest-factoryboy==2.1.0 syrupy==1.4.7 +# TODO remove pytz dep again once DRF higher than 3.12.4 is released +# Django 4.0 removed dependency on pytz and made it optional but +# DRF requires it and will define it as dependency in future versions +# only adding this to testing though as DJA does not directly use pytz +pytz==2021.3 diff --git a/setup.cfg b/setup.cfg index 31e61331..2947a883 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,8 +58,8 @@ DJANGO_SETTINGS_MODULE=example.settings.test filterwarnings = error::DeprecationWarning error::PendingDeprecationWarning - # Django Debug Toolbar currently (2021-04-07) specifies default_app_config which is deprecated in Django 3.2: - ignore:'debug_toolbar' defines default_app_config = 'debug_toolbar.apps.DebugToolbarConfig'. Django now detects this configuration automatically. You can remove default_app_config.:PendingDeprecationWarning + # TODO remove again once DRF higher than 3.12.4 has been released + ignore:'rest_framework' defines default_app_config # TODO remove in next major version of DJA 5.0.0 # this deprecation warning filter needs to be added as AuthorSerializer is used in # too many tests which introduced the type field name in tests diff --git a/setup.py b/setup.py index 08712129..24611c13 100755 --- a/setup.py +++ b/setup.py @@ -97,7 +97,7 @@ def get_package_data(package): install_requires=[ "inflection>=0.3.0", "djangorestframework>=3.12,<3.13", - "django>=2.2,<3.3", + "django>=2.2,<4.1", ], extras_require={ "django-polymorphic": ["django-polymorphic>=2.0"], diff --git a/tests/test_relations.py b/tests/test_relations.py index 630dd9c8..74721cfa 100644 --- a/tests/test_relations.py +++ b/tests/test_relations.py @@ -1,5 +1,5 @@ import pytest -from django.conf.urls import re_path +from django.urls import re_path from rest_framework import status from rest_framework.fields import SkipField from rest_framework.routers import SimpleRouter diff --git a/tox.ini b/tox.ini index 075cffc5..10b31f56 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,7 @@ [tox] envlist = py{36,37,38,39}-django{22,30,31,32}-drf{312,master}, + py{38,39}-django40-drf{312,master}, lint,docs [testenv] @@ -9,6 +10,7 @@ deps = django30: Django>=3.0,<3.1 django31: Django>=3.1,<3.2 django32: Django>=3.2,<3.3 + django40: Django>=4.0b1,<5.0 drf312: djangorestframework>=3.12,<3.13 drfmaster: https://github.com/encode/django-rest-framework/archive/master.zip -rrequirements/requirements-testing.txt From 991fcbaebbd4c6c908fdd0b72af5f2b057d160da Mon Sep 17 00:00:00 2001 From: Oliver Sauder Date: Mon, 22 Nov 2021 15:32:32 +0400 Subject: [PATCH 2/2] Bump to Django 4.0 first release candidate --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 10b31f56..b8b1a6ea 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ deps = django30: Django>=3.0,<3.1 django31: Django>=3.1,<3.2 django32: Django>=3.2,<3.3 - django40: Django>=4.0b1,<5.0 + django40: Django>=4.0rc1,<5.0 drf312: djangorestframework>=3.12,<3.13 drfmaster: https://github.com/encode/django-rest-framework/archive/master.zip -rrequirements/requirements-testing.txt