[PATCH 01/19] settings: Enable 'SessionAuthenticationMiddleware'

Stephen Finucane stephen at that.guru
Thu May 11 05:45:10 AEST 2017


This raises warnings for Django 1.8 and is mandatory in Django 1.10. It
provides a helpful feature, invalidating a user's session when their
password is changed, and can/should be enabled.

This resolves all issues with Django 1.8.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/settings/base.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index 5f6aebe..d82c41d 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -35,10 +35,16 @@ MIDDLEWARE_CLASSES = [
 ]
 
 if django.VERSION >= (1, 7):
-    MIDDLEWARE_CLASSES.append(
-        'django.contrib.admindocs.middleware.XViewMiddleware')
+    MIDDLEWARE_CLASSES += [
+        'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
+    ]
+
+if django.VERSION >= (1, 7):
+    MIDDLEWARE_CLASSES += [
+        'django.contrib.admindocs.middleware.XViewMiddleware'
+    ]
 else:
-    MIDDLEWARE_CLASSES.append('django.middleware.doc.XViewMiddleware')
+    MIDDLEWARE_CLASSES += ['django.middleware.doc.XViewMiddleware']
 
 TIME_ZONE = 'Australia/Canberra'
 
-- 
2.9.3



More information about the Patchwork mailing list