From 2fa0bffb5271cfa1fa282ccc06078adb6761a6a3 Mon Sep 17 00:00:00 2001 From: Raghav Sharma Date: Mon, 23 Dec 2024 23:47:56 +0530 Subject: [PATCH 1/4] allow old --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9615f1a0..7a42d0e9 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ ], python_requires='>=3.7', install_requires=[ - 'django>=3.2', + 'django>=2.0', 'redis>=3.0.0', 'funcy>=1.8', ], From dc60642a46213889952f258cc41a27e774b0be87 Mon Sep 17 00:00:00 2001 From: Raghav Sharma Date: Tue, 24 Dec 2024 00:44:50 +0530 Subject: [PATCH 2/4] tweak --- cacheops/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cacheops/__init__.py b/cacheops/__init__.py index 055d70bf..c2a9d1f5 100644 --- a/cacheops/__init__.py +++ b/cacheops/__init__.py @@ -1,8 +1,19 @@ __version__ = '7.1' VERSION = tuple(map(int, __version__.split('.'))) +from django.apps import AppConfig from .simple import * # noqa from .query import * # noqa from .invalidation import * # noqa from .reaper import * # noqa from .templatetags.cacheops import * # noqa +from .transaction import * # noqa + +class CacheopsConfig(AppConfig): + name = 'cacheops' + + def ready(self): + install_cacheops() + install_cacheops_transaction_support() + +default_app_config = 'cacheops.CacheopsConfig' From d58510ea5e5a5f3fd34d2c13dda5b722a09ee24a Mon Sep 17 00:00:00 2001 From: Raghav Sharma Date: Tue, 24 Dec 2024 01:28:10 +0530 Subject: [PATCH 3/4] tweak --- cacheops/query.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cacheops/query.py b/cacheops/query.py index 2c631bf7..dea4b45a 100644 --- a/cacheops/query.py +++ b/cacheops/query.py @@ -7,9 +7,14 @@ from django.utils.encoding import force_str from django.core.exceptions import ImproperlyConfigured, EmptyResultSet -from django.db import DEFAULT_DB_ALIAS, connections, models +from django.db import DEFAULT_DB_ALIAS, models from django.db.models.manager import BaseManager from django.db.models.query import MAX_GET_RESULTS +try: + from django.db.models.query import MAX_GET_RESULTS + from django.db import connections +except ImportError: + MAX_GET_RESULTS = None from django.db.models.signals import pre_save, post_save, post_delete, m2m_changed from django.db.transaction import atomic @@ -28,7 +33,6 @@ _local_get_cache = {} - def cached_as(*samples, timeout=None, extra=None, lock=None, keep_fresh=False): """ Caches results of a function and invalidates them same way as given queryset(s). From 56eece76138687e409ad71e1ebf1e7ee3bcd4ea8 Mon Sep 17 00:00:00 2001 From: Raghav Sharma Date: Tue, 24 Dec 2024 01:36:50 +0530 Subject: [PATCH 4/4] fix --- cacheops/query.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cacheops/query.py b/cacheops/query.py index dea4b45a..96e56904 100644 --- a/cacheops/query.py +++ b/cacheops/query.py @@ -9,7 +9,6 @@ from django.core.exceptions import ImproperlyConfigured, EmptyResultSet from django.db import DEFAULT_DB_ALIAS, models from django.db.models.manager import BaseManager -from django.db.models.query import MAX_GET_RESULTS try: from django.db.models.query import MAX_GET_RESULTS from django.db import connections