Update custom user model for django 1.9ish.
[htsworkflow.git] / samples / auth_backend.py
index 18fbe5c61fd19c7850db91bb4f0feb1ce1c3236a..bfda0d6b438ab4624bbd0079bb7fe67accf29c25 100644 (file)
@@ -3,7 +3,7 @@ from __future__ import absolute_import, print_function, unicode_literals
 from django.conf import settings
 from django.contrib.auth.backends import ModelBackend
 from django.core.exceptions import ImproperlyConfigured
-from django.db.models import get_model
+from django.contrib.auth import get_user_model
 
 import logging
 import sys
@@ -32,7 +32,7 @@ class HTSUserModelBackend(ModelBackend):
     @property
     def user_class(self):
         if not hasattr(self, '_user_class'):
-            self._user_class = get_model(*settings.CUSTOM_USER_MODEL.split('.', 2))
+            self._user_class = get_user_model()
             if not self._user_class:
                 raise ImproperlyConfigured('Could not get custom user model')
             return self._user_class