Skip to content

Commit

Permalink
Merge pull request #18 from derenio/replace_django_get_cache_with_caches
Browse files Browse the repository at this point in the history
Fixes RemovedInDjango19Warning IRT 'get_cache'
  • Loading branch information
respondcreate committed Jul 8, 2015
2 parents 9b3c271 + 58405c3 commit 67dbd61
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions versatileimagefield/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from django.conf import settings
from django.core.cache import (
cache as default_cache,
get_cache,
InvalidCacheBackendError
)

Expand Down Expand Up @@ -59,7 +58,14 @@
)

try:
cache = get_cache(VERSATILEIMAGEFIELD_CACHE_NAME)
# Beginning with Django 1.7 'get_cache' is deprecated in favor of 'caches'
# and will be dropped in Django 1.9
try:
from django.core.cache import caches
cache = caches[VERSATILEIMAGEFIELD_CACHE_NAME]
except ImportError:
from django.core.cache import get_cache
cache = get_cache(VERSATILEIMAGEFIELD_CACHE_NAME)
except InvalidCacheBackendError:
cache = default_cache

Expand Down

0 comments on commit 67dbd61

Please sign in to comment.