Update custom user model for django 1.9ish.
authorDiane Trout <diane@ghic.org>
Thu, 2 Jun 2016 20:43:28 +0000 (13:43 -0700)
committerDiane Trout <diane@ghic.org>
Fri, 24 Jun 2016 22:55:58 +0000 (15:55 -0700)
They implemented some nicer ways of overriding the user model

samples/auth_backend.py
samples/models.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
index acf66e9a30f34a267d8902c05370e9f3ae446141..32a917ed51c34ec8b1fc1569a48afa19b4f24771 100644 (file)
@@ -480,6 +480,7 @@ class HTSUser(User):
     # objects = UserManager()
 
     class Meta:
+        proxy = True
         ordering = ['first_name', 'last_name', 'username']
 
     def admin_url(self):