Commits

Błażej Pindelski committed d29f517

Add extensible method to define User model.

Comments (0)

Files changed (1)

django_auth_ldap/backend.py

         return self._ldap
     ldap = property(_get_ldap)
 
+    def get_user_model(self):
+        return get_user_model()
+
     #
     # The Django auth backend API
     #
         user = None
 
         try:
-            user = get_user_model().objects.get(pk=user_id)
+            user = self.get_user_model().objects.get(pk=user_id)
             _LDAPUser(self, user=user) # This sets user.ldap_user
         except ObjectDoesNotExist:
             pass
         username is the Django-friendly username of the user. ldap_user.dn is
         the user's DN and ldap_user.attrs contains all of their LDAP attributes.
         """
-        model = get_user_model()
+        model = self.get_user_model()
         username_field = getattr(model, 'USERNAME_FIELD', 'username')
 
         kwargs = {