Skip to content

Commit

Permalink
Add Django 5.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Sami El Achi committed Mar 30, 2024
1 parent ca3317e commit 05cafb2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 43 deletions.
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 @@ -40,7 +40,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 @@ -138,11 +138,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 @@ -219,18 +218,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 @@ -258,18 +251,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 @@ -309,17 +296,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 @@ -341,17 +322,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

0 comments on commit 05cafb2

Please sign in to comment.