Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Django v4 support #199

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions ring/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

import warnings

import django

_DJANGO_VERSION = getattr(django, "VERSION", (0, 0, 0))
if _DJANGO_VERSION[0] >= 4:
raise ImportError("Django >= 4 is not supported yet")

from django.core import cache as django_cache
from django.http.request import HttpRequest
Expand Down Expand Up @@ -297,9 +292,16 @@

:see: :func:`django.views.decorators.cache.cache_page`.
""" # noqa

def dummy_get_response(request):
return None

Check warning on line 297 in ring/django.py

View check run for this annotation

Codecov / codecov/patch

ring/django.py#L297

Added line #L297 was not covered by tests

middleware_class = CacheMiddleware
middleware = middleware_class(
cache_timeout=timeout, cache_alias=cache, key_prefix=key_prefix
get_response=dummy_get_response,
cache_timeout=timeout,
cache_alias=cache,
key_prefix=key_prefix,
)

return fbase.factory(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_version():
"redis>=4.2.0;python_version>='3.0'",
"requests",
"diskcache>=4.1.0",
"django<4",
"django",
"numpy",
]
docs_require = [
Expand Down
Loading