From 255353f695d6eecbaaaf9eb5b8c6a4def7b24ddf Mon Sep 17 00:00:00 2001 From: Nik Nyby Date: Tue, 5 Dec 2017 12:52:42 -0500 Subject: [PATCH] is_authenticated fix for django 2.0 https://docs.djangoproject.com/en/2.0/releases/2.0/#features-removed-in-2-0 --- djangowind/context.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/djangowind/context.py b/djangowind/context.py index 22e8845..cec8fc6 100644 --- a/djangowind/context.py +++ b/djangowind/context.py @@ -10,6 +10,14 @@ def context_processor(request): 'WIND_SERVICE': getattr(settings, 'WIND_SERVICE', None), 'CAS_BASE': getattr(settings, 'CAS_BASE', None), } - if not request.user.is_authenticated(): + + try: + # For django 1.8 + is_authed = request.user.is_authenticated() + except TypeError: + is_authed = request.user.is_authenticated + + if not is_authed: d['login_form'] = AuthenticationForm(request) + return d