Skip to content

Commit

Permalink
Fix Django support
Browse files Browse the repository at this point in the history
reference encode/django-rest-framework#7513

Signed-off-by: weiyang <weiyang.ones@gmail.com>
  • Loading branch information
wy-z committed Dec 8, 2023
1 parent b5c34df commit 26c49ea
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

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

0 comments on commit 26c49ea

Please sign in to comment.