Skip to content

Commit

Permalink
Merge pull request #199 from wy-z/main
Browse files Browse the repository at this point in the history
Fix Django v4 support
  • Loading branch information
youknowone authored Dec 8, 2023
2 parents b5c34df + 26c49ea commit 99ea8a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
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 @@ def article_post_django(request):
:see: :func:`django.views.decorators.cache.cache_page`.
""" # noqa

def dummy_get_response(request):
return None

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

0 comments on commit 99ea8a9

Please sign in to comment.