From 6fe841337d2cecc78f68be1d5bc34908c41970a3 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 16 Jun 2016 11:45:08 +0100 Subject: [PATCH] Fix missing import --- channels/auth.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/channels/auth.py b/channels/auth.py index 06e826b..90eaaff 100644 --- a/channels/auth.py +++ b/channels/auth.py @@ -60,6 +60,8 @@ def http_session_user(func): if not hasattr(message, "http_session"): raise ValueError("Did not see a http session to get auth from") if message.http_session is None: + # Inner import to avoid reaching into models before load complete + from django.contrib.auth.models import AnonymousUser message.user = AnonymousUser() # Otherwise, be a bit naughty and make a fake Request with just # a "session" attribute (later on, perhaps refactor contrib.auth to