]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
settings: Use 'MIDDLEWARE' for Django >= 1.10
authorStephen Finucane <stephen@that.guru>
Thu, 18 May 2017 20:17:44 +0000 (21:17 +0100)
committerStephen Finucane <stephen@that.guru>
Thu, 18 May 2017 20:17:44 +0000 (21:17 +0100)
This raises warnings in Django 1.10 and will be mandatory in Django 2.0.

Signed-off-by: Stephen Finucane <stephen@that.guru>
patchwork/settings/base.py
patchwork/settings/dev.py

index d82c41d4212a39f4999781aa19c0adf0f1f74a17..8776a5edcee0335e9f9dbb274fb18bae8f6419a9 100644 (file)
@@ -26,7 +26,7 @@ INSTALLED_APPS = [
     'patchwork',
 ]
 
-MIDDLEWARE_CLASSES = [
+_MIDDLEWARE_CLASSES = [
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
@@ -35,16 +35,21 @@ MIDDLEWARE_CLASSES = [
 ]
 
 if django.VERSION >= (1, 7):
-    MIDDLEWARE_CLASSES += [
+    _MIDDLEWARE_CLASSES += [
         'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
     ]
 
 if django.VERSION >= (1, 7):
-    MIDDLEWARE_CLASSES += [
+    _MIDDLEWARE_CLASSES += [
         'django.contrib.admindocs.middleware.XViewMiddleware'
     ]
 else:
-    MIDDLEWARE_CLASSES += ['django.middleware.doc.XViewMiddleware']
+    _MIDDLEWARE_CLASSES += ['django.middleware.doc.XViewMiddleware']
+
+if django.VERSION >= (1, 10):
+    MIDDLEWARE = _MIDDLEWARE_CLASSES
+else:
+    MIDDLEWARE_CLASSES = _MIDDLEWARE_CLASSES
 
 TIME_ZONE = 'Australia/Canberra'
 
index 86b0f1b2580bb40bc67d34bfc8816fdd8bee5b78..26d3e830985cf2cf500036dd6ddc999f0466b492 100644 (file)
@@ -76,9 +76,14 @@ if django.VERSION >= (1, 8):
     DEBUG_TOOLBAR_PATCH_SETTINGS = False
 
     # This should go first in the middleware classes
-    MIDDLEWARE_CLASSES = [
-        'debug_toolbar.middleware.DebugToolbarMiddleware',
-    ] + MIDDLEWARE_CLASSES
+    if django.VERSION >= (1, 10):
+        MIDDLEWARE = [
+            'debug_toolbar.middleware.DebugToolbarMiddleware',
+        ] + MIDDLEWARE
+    else:
+        MIDDLEWARE_CLASSES = [
+            'debug_toolbar.middleware.DebugToolbarMiddleware',
+        ] + MIDDLEWARE_CLASSES
 
     INTERNAL_IPS = [
         '127.0.0.1', '::1',