django 1.10 compatability
parent
8f1163602b
commit
f8c377bc3b
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue