import md5
from django.conf import settings
-from django.contrib.auth.models import User
from django.contrib.auth.backends import ModelBackend
-from .models import UserSocialAuth
+from .models import UserSocialAuth, get_user_model
+User = get_user_model()
class BaseAuth(object):
"""Base authentication class, new authenticators should subclass
"""Social auth models"""
from django.db import models
-from django.contrib.auth.models import User
+from django.conf import settings
+def get_user_model():
+ """Allow setting a custom (extended) user model"""
+ _from, _model = getattr(settings, 'SOCIAL_AUTH_MODEL_USER', 'django.contrib.auth.models.User').rsplit('.', 1)
+ return getattr(__import__(_from, globals(), locals(), [_model], -1), _model)
+
+User = get_user_model()
class UserSocialAuth(models.Model):
"""Social Auth association model"""