Skip to content

Commit

Permalink
Raise the minimum Django version to 4.2 (#1880)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Feb 22, 2024
1 parent 7d77a34 commit e80c05d
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Expand Up @@ -17,7 +17,7 @@ repos:
rev: 1.16.0
hooks:
- id: django-upgrade
args: [--target-version, "3.2"]
args: [--target-version, "4.2"]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -44,8 +44,8 @@ Here's a screenshot of the toolbar in action:
In addition to the built-in panels, a number of third-party panels are
contributed by the community.

The current stable version of the Debug Toolbar is 4.1.0. It works on
Django ≥ 3.2.4.
The current stable version of the Debug Toolbar is 4.3.0. It works on
Django ≥ 4.2.0.

The Debug Toolbar does not currently support `Django's asynchronous views
<https://docs.djangoproject.com/en/dev/topics/async/>`_.
Expand Down
1 change: 1 addition & 0 deletions docs/changes.rst
Expand Up @@ -4,6 +4,7 @@ Change log
Pending
-------

* Raised the minimum Django version to 4.2.
* Automatically support Docker rather than having the developer write a
workaround for ``INTERNAL_IPS``.

Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Expand Up @@ -17,8 +17,6 @@ classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Intended Audience :: Developers",
Expand All @@ -37,7 +35,7 @@ dynamic = [
"version",
]
dependencies = [
"Django>=3.2.4",
"Django>=4.2.9",
"sqlparse>=0.2",
]
[project.urls]
Expand Down
36 changes: 24 additions & 12 deletions tests/test_integration.py
Expand Up @@ -266,13 +266,15 @@ def test_render_panel_checks_show_toolbar(self):

response = self.client.get(url, data)
self.assertEqual(response.status_code, 200)
response = self.client.get(url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest")
response = self.client.get(
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 200)
with self.settings(INTERNAL_IPS=[]):
response = self.client.get(url, data)
self.assertEqual(response.status_code, 404)
response = self.client.get(
url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest"
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 404)

Expand Down Expand Up @@ -302,13 +304,15 @@ def test_template_source_checks_show_toolbar(self):

response = self.client.get(url, data)
self.assertEqual(response.status_code, 200)
response = self.client.get(url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest")
response = self.client.get(
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 200)
with self.settings(INTERNAL_IPS=[]):
response = self.client.get(url, data)
self.assertEqual(response.status_code, 404)
response = self.client.get(
url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest"
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 404)

Expand Down Expand Up @@ -348,13 +352,15 @@ def test_sql_select_checks_show_toolbar(self):

response = self.client.post(url, data)
self.assertEqual(response.status_code, 200)
response = self.client.post(url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest")
response = self.client.post(
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 200)
with self.settings(INTERNAL_IPS=[]):
response = self.client.post(url, data)
self.assertEqual(response.status_code, 404)
response = self.client.post(
url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest"
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 404)

Expand All @@ -374,13 +380,15 @@ def test_sql_explain_checks_show_toolbar(self):

response = self.client.post(url, data)
self.assertEqual(response.status_code, 200)
response = self.client.post(url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest")
response = self.client.post(
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 200)
with self.settings(INTERNAL_IPS=[]):
response = self.client.post(url, data)
self.assertEqual(response.status_code, 404)
response = self.client.post(
url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest"
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 404)

Expand All @@ -406,13 +414,15 @@ def test_sql_explain_postgres_json_field(self):
}
response = self.client.post(url, data)
self.assertEqual(response.status_code, 200)
response = self.client.post(url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest")
response = self.client.post(
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 200)
with self.settings(INTERNAL_IPS=[]):
response = self.client.post(url, data)
self.assertEqual(response.status_code, 404)
response = self.client.post(
url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest"
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 404)

Expand All @@ -432,13 +442,15 @@ def test_sql_profile_checks_show_toolbar(self):

response = self.client.post(url, data)
self.assertEqual(response.status_code, 200)
response = self.client.post(url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest")
response = self.client.post(
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 200)
with self.settings(INTERNAL_IPS=[]):
response = self.client.post(url, data)
self.assertEqual(response.status_code, 404)
response = self.client.post(
url, data, HTTP_X_REQUESTED_WITH="XMLHttpRequest"
url, data, headers={"x-requested-with": "XMLHttpRequest"}
)
self.assertEqual(response.status_code, 404)

Expand Down
16 changes: 6 additions & 10 deletions tox.ini
Expand Up @@ -3,16 +3,13 @@ isolated_build = true
envlist =
docs
packaging
py{38,39,310}-dj32-{sqlite,postgresql,postgis,mysql}
py{310,311}-dj41-{sqlite,postgresql,postgis,mysql}
py{38,39,310,311,312}-dj{42}-{sqlite,postgresql,postgis,mysql}
py{310,311,312}-dj{42,50,main}-{sqlite,postgresql,psycopg3,postgis,mysql}

[testenv]
deps =
dj32: django~=3.2.9
dj41: django~=4.1.3
dj42: django~=4.2.1
dj50: django~=5.0a1
dj50: django~=5.0.2
djmain: https://github.com/django/django/archive/main.tar.gz
postgresql: psycopg2-binary
psycopg3: psycopg[binary]
Expand All @@ -37,7 +34,6 @@ passenv=
setenv =
PYTHONPATH = {toxinidir}
PYTHONWARNINGS = d
py39-dj32-postgresql: DJANGO_SELENIUM_TESTS = true
py311-dj42-postgresql: DJANGO_SELENIUM_TESTS = true
DB_NAME = {env:DB_NAME:debug_toolbar}
DB_USER = {env:DB_USER:debug_toolbar}
Expand All @@ -49,28 +45,28 @@ pip_pre = True
commands = python -b -W always -m coverage run -m django test -v2 {posargs:tests}


[testenv:py{38,39,310,311,312}-dj{32,41,42,50,main}-{postgresql,psycopg3}]
[testenv:py{38,39,310,311,312}-dj{42,50,main}-{postgresql,psycopg3}]
setenv =
{[testenv]setenv}
DB_BACKEND = postgresql
DB_PORT = {env:DB_PORT:5432}


[testenv:py{38,39,310,311,312}-dj{32,41,42,50,main}-postgis]
[testenv:py{38,39,310,311,312}-dj{42,50,main}-postgis]
setenv =
{[testenv]setenv}
DB_BACKEND = postgis
DB_PORT = {env:DB_PORT:5432}


[testenv:py{38,39,310,311,312}-dj{32,41,42,50,main}-mysql]
[testenv:py{38,39,310,311,312}-dj{42,50,main}-mysql]
setenv =
{[testenv]setenv}
DB_BACKEND = mysql
DB_PORT = {env:DB_PORT:3306}


[testenv:py{38,39,310,311,312}-dj{32,41,42,50,main}-sqlite]
[testenv:py{38,39,310,311,312}-dj{42,50,main}-sqlite]
setenv =
{[testenv]setenv}
DB_BACKEND = sqlite3
Expand Down

0 comments on commit e80c05d

Please sign in to comment.