From 0e884b6479f5390716aaa283909772c2b4b25080 Mon Sep 17 00:00:00 2001 From: Calum Young Date: Mon, 6 May 2024 14:51:28 +0100 Subject: [PATCH 1/4] Update minimum supported django version to 4.2 --- setup.py | 2 +- tox.ini | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/setup.py b/setup.py index ebeb960..f1c0281 100644 --- a/setup.py +++ b/setup.py @@ -69,7 +69,7 @@ # https://packaging.python.org/en/latest/requirements.html python_requires='>=3.6', install_requires=[ - 'django>=3.2', + 'django>=4.2', 'djangorestframework', ], diff --git a/tox.ini b/tox.ini index aaf7748..abd6e01 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,5 @@ [tox] envlist = - py{36,37,38,39,310}-django32, py{38,39,310,311,312}-django42, py{310,311,312}-django50, @@ -13,7 +12,6 @@ setenv = DJANGO_SETTINGS_MODULE = knox_project.settings PIP_INDEX_URL = https://pypi.python.org/simple/ deps = - django32: Django>=3.2,<3.3 django42: Django>=4.2,<4.3 django50: Django>=5.0,<5.1 markdown>=3.0 From fe72142c87d0287bc4f9e8bce5b4e270379eb9af Mon Sep 17 00:00:00 2001 From: Calum Young Date: Mon, 6 May 2024 14:51:56 +0100 Subject: [PATCH 2/4] Update minumum supported python version to 4.2 --- .github/workflows/test.yml | 2 +- setup.py | 3 +-- tox.ini | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de70e1e..c089093 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false max-parallel: 5 matrix: - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 diff --git a/setup.py b/setup.py index f1c0281..75ae42a 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,6 @@ # Pick your license as you wish (should match "license" above) 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', @@ -67,7 +66,7 @@ # your project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # https://packaging.python.org/en/latest/requirements.html - python_requires='>=3.6', + python_requires='>=3.8', install_requires=[ 'django>=4.2', 'djangorestframework', diff --git a/tox.ini b/tox.ini index abd6e01..5b17cb8 100644 --- a/tox.ini +++ b/tox.ini @@ -26,8 +26,6 @@ deps = [gh-actions] python = - 3.6: py36 - 3.7: py37 3.8: py38 3.9: py39 3.10: py310 From fc3fb8301a17a7795529afb3a2c9c4e0d386cabd Mon Sep 17 00:00:00 2001 From: Calum Young Date: Mon, 6 May 2024 14:53:17 +0100 Subject: [PATCH 3/4] Add django upgrade pre-commit hook --- .pre-commit-config.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eac9b90..8833796 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,10 @@ repos: + - repo: https://github.com/adamchainz/django-upgrade + rev: 1.16.0 + hooks: + - id: django-upgrade + args: [--target-version, "4.2"] + - repo: https://github.com/PyCQA/isort rev: 5.13.2 hooks: @@ -6,4 +12,4 @@ repos: - repo: https://github.com/PyCQA/flake8 rev: 7.0.0 hooks: - - id: flake8 \ No newline at end of file + - id: flake8 From 48019215247a9d7fe3dbce48a0a77ad1d95fab9a Mon Sep 17 00:00:00 2001 From: Calum Young Date: Mon, 6 May 2024 14:54:01 +0100 Subject: [PATCH 4/4] Run django upgrade --- knox_project/settings.py | 1 - knox_project/urls.py | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/knox_project/settings.py b/knox_project/settings.py index d5b6c40..a6b07b0 100644 --- a/knox_project/settings.py +++ b/knox_project/settings.py @@ -49,7 +49,6 @@ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True -USE_L10N = True # Deprecated since django 4.0. USE_TZ = True STATIC_URL = '/static/' diff --git a/knox_project/urls.py b/knox_project/urls.py index fa9ccfc..bd44c3a 100644 --- a/knox_project/urls.py +++ b/knox_project/urls.py @@ -1,8 +1,8 @@ -from django.urls import include, re_path +from django.urls import include, path from .views import RootView urlpatterns = [ - re_path(r'^api/', include('knox.urls')), - re_path(r'^api/$', RootView.as_view(), name="api-root"), + path('api/', include('knox.urls')), + path('api/', RootView.as_view(), name="api-root"), ]