Skip to content

Commit

Permalink
Add Django support for version 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sami El Achi committed Mar 29, 2024
1 parent 3968f41 commit 8a20f52
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 56 deletions.
26 changes: 13 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ classifiers = [
"Development Status :: 4 - Beta",
"Framework :: Django",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
Expand All @@ -36,7 +37,7 @@ exclude = ["tests", "docs"]

[tool.poetry.dependencies]
python = ">=3.8"
django = ">=4.2,<5.0"
django = ">=4.2"

[tool.poetry.group.dev.dependencies]
django-debug-toolbar = "^3.2.4" # unparallelled debugging in django
Expand Down
59 changes: 17 additions & 42 deletions tests/test_admin_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_logout(admin_client):
"""
url = reverse("admin:logout")

response = admin_client.get(url)
response = admin_client.post(url)
templates_used = [t.name for t in response.templates]

assert response.status_code == 200
Expand Down Expand Up @@ -140,11 +140,10 @@ def test_password_change(admin_client):
"django/forms/widgets/input.html",
"django/forms/widgets/attrs.html",
"jazzmin/includes/ui_builder_panel.html",
"django/forms/errors/list/default.html",
"django/forms/errors/list/ul.html",
}

if django.VERSION[0] == 4:
expected_templates_used.update({"django/forms/errors/list/default.html", "django/forms/errors/list/ul.html"})

assert response.status_code == 200
assert set(templates_used) == expected_templates_used

Expand Down Expand Up @@ -221,18 +220,12 @@ def test_detail(admin_client):
"django/forms/widgets/time.html": 2,
"jazzmin/includes/horizontal_tabs.html": 1,
"jazzmin/includes/ui_builder_panel.html": 1,
"django/forms/div.html": 1,
"django/forms/errors/list/default.html": 2,
"admin/widgets/date.html": 3,
"django/forms/errors/list/ul.html": 56,
}

if django.VERSION[0] == 4:
expected_render_counts.update(
{
"django/forms/div.html": 1,
"django/forms/errors/list/default.html": 2,
"admin/widgets/date.html": 3,
"django/forms/errors/list/ul.html": 56,
}
)

# The number of times each template was rendered
assert render_counts == expected_render_counts

Expand Down Expand Up @@ -260,18 +253,12 @@ def test_detail(admin_client):
"django/forms/widgets/time.html",
"jazzmin/includes/horizontal_tabs.html",
"jazzmin/includes/ui_builder_panel.html",
"django/forms/div.html",
"django/forms/errors/list/default.html",
"admin/widgets/date.html",
"django/forms/errors/list/ul.html",
}

if django.VERSION[0] == 4:
expected_templates_used.update(
{
"django/forms/div.html",
"django/forms/errors/list/default.html",
"admin/widgets/date.html",
"django/forms/errors/list/ul.html",
}
)

# The templates that were used
assert set(templates_used) == expected_templates_used

Expand Down Expand Up @@ -311,17 +298,11 @@ def test_list(admin_client):
"django/forms/widgets/select_option.html": 4,
"django/forms/widgets/text.html": 5,
"jazzmin/includes/ui_builder_panel.html": 1,
"django/forms/div.html": 1,
"django/forms/errors/list/default.html": 6,
"django/forms/errors/list/ul.html": 6,
}

if django.VERSION[0] == 4:
expected_render_counts.update(
{
"django/forms/div.html": 1,
"django/forms/errors/list/default.html": 6,
"django/forms/errors/list/ul.html": 6,
}
)

# The number of times each template was rendered
assert render_counts == expected_render_counts

Expand All @@ -343,17 +324,11 @@ def test_list(admin_client):
"django/forms/widgets/select_option.html",
"django/forms/widgets/text.html",
"jazzmin/includes/ui_builder_panel.html",
"django/forms/div.html",
"django/forms/errors/list/default.html",
"django/forms/errors/list/ul.html",
}

if django.VERSION[0] == 4:
expected_templates.update(
{
"django/forms/div.html",
"django/forms/errors/list/default.html",
"django/forms/errors/list/ul.html",
}
)

# The templates that were used
assert set(templates_used) == expected_templates

Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tox]
envlist =
django4-{python3.8,python3.9,python3.10,python3.11,python3.12},
django5-{python3.10,python3.11,python3.12},
# run one of the tests again but with coverage
coveralls-django4-python3.11,
skipsdist = True
Expand Down Expand Up @@ -30,6 +31,7 @@ deps =
beautifulsoup4
factory-boy
django4: Django<5
django5: Django<6

[testenv:coveralls-django4-python3.11]
passenv = COVERALLS_REPO_TOKEN
Expand Down

0 comments on commit 8a20f52

Please sign in to comment.