summaryrefslogtreecommitdiff
path: root/openstack_auth/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstack_auth/utils.py')
-rw-r--r--openstack_auth/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/openstack_auth/utils.py b/openstack_auth/utils.py
index 3d49b7a..d38d513 100644
--- a/openstack_auth/utils.py
+++ b/openstack_auth/utils.py
@@ -17,7 +17,6 @@ import re
from django.conf import settings
from django.contrib import auth
-from django.contrib.auth import middleware
from django.contrib.auth import models
from django.utils import timezone
from keystoneauth1.identity import v2 as v2_auth
@@ -62,6 +61,10 @@ def get_user(request):
def patch_middleware_get_user():
+ # NOTE(adriant): We can't import middleware until our customer user model
+ # is actually registered, otherwise a call to get_user_model within the
+ # middleware module will fail.
+ from django.contrib.auth import middleware
middleware.get_user = middleware_get_user
auth.get_user = get_user