Skip to content

Commit d58510e

Browse files
committed
tweak
1 parent dc60642 commit d58510e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cacheops/query.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@
77

88
from django.utils.encoding import force_str
99
from django.core.exceptions import ImproperlyConfigured, EmptyResultSet
10-
from django.db import DEFAULT_DB_ALIAS, connections, models
10+
from django.db import DEFAULT_DB_ALIAS, models
1111
from django.db.models.manager import BaseManager
1212
from django.db.models.query import MAX_GET_RESULTS
13+
try:
14+
from django.db.models.query import MAX_GET_RESULTS
15+
from django.db import connections
16+
except ImportError:
17+
MAX_GET_RESULTS = None
1318
from django.db.models.signals import pre_save, post_save, post_delete, m2m_changed
1419
from django.db.transaction import atomic
1520

@@ -28,7 +33,6 @@
2833

2934
_local_get_cache = {}
3035

31-
3236
def cached_as(*samples, timeout=None, extra=None, lock=None, keep_fresh=False):
3337
"""
3438
Caches results of a function and invalidates them same way as given queryset(s).

0 commit comments

Comments
 (0)