django 1.10 compatability

dj111
eric 2018-05-07 12:42:15 -04:00
parent 8f1163602b
commit f8c377bc3b
2 changed files with 9 additions and 2 deletions

View File

@ -13,7 +13,7 @@ from django.template import loader
from django.utils import translation
from django.conf import settings
from django.http import Http404, HttpResponse
from django.shortcuts import render_to_response, get_object_or_404
from django.shortcuts import get_object_or_404
from .models import Subject, QuestionSet, RunInfo, Questionnaire
try: from hashlib import md5

View File

@ -9,6 +9,13 @@ from functools import wraps
from threading import currentThread
from django.core.cache.backends.locmem import LocMemCache
try:
from django.utils.deprecation import MiddlewareMixin
except ImportError:
# djang0 < 1.10
class MiddlewareMixin(object):
pass
_request_cache = {}
_installed_middleware = False
@ -25,7 +32,7 @@ class RequestCache(LocMemCache):
params = dict()
super(RequestCache, self).__init__(name, params)
class RequestCacheMiddleware(object):
class RequestCacheMiddleware(MiddlewareMixin):
def __init__(self):
global _installed_middleware
_installed_middleware = True