M webutils/baseacct/forms.py +4 -3
@@ 1,6 1,6 @@
from django import forms
from django.conf import settings
-from django.contrib.auth.models import User
+from django.contrib.auth import get_user_model
from django.contrib.auth.forms import AuthenticationForm
from django.utils.translation import ugettext_lazy as _
@@ 14,7 14,8 @@ class ResetForm(forms.Form):
def clean_email(self):
if 'email' in self.cleaned_data:
email = self.cleaned_data['email']
- if not User.objects.filter(email__iexact=email).count() > 0:
+ if not get_user_model().objects.filter(
+ email__iexact=email).count() > 0:
raise forms.ValidationError(
u'There is no account registered to this email address.'
)
@@ 65,4 66,4 @@ class PasswordChangeForm(forms.Form):
def save(self):
self.user.set_password(self.cleaned_data['new_password'])
- self.user.save()
No newline at end of file
+ self.user.save()
M webutils/baseacct/models.py +6 -3
@@ 1,9 1,12 @@
+from django.db import models
from django.conf import settings
-from django.db import models
-from django.contrib.auth.models import UserManager, User
+from django.contrib.auth import get_user_model
+from django.contrib.auth.models import UserManager
from django.utils.translation import ugettext_lazy as _
from webutils.djtools.email import send_simple_email
+User = get_user_model()
+
class BaseUserProfileManager(UserManager):
def generate_hash(self):
@@ 69,7 72,7 @@ class BaseUserProfileManager(UserManager
class BaseUserProfile(models.Model):
user = models.ForeignKey(
- User,
+ setting.AUTH_USER_MODEL,
unique=True,
verbose_name=_('User Account'),
help_text=_('User Profiles must be "tied" to a user account.'),
M webutils/baseacct/views.py +2 -3
@@ 1,8 1,7 @@
from django.conf import settings
-from django.contrib.auth.models import User
+from django.shortcuts import render, redirect
+from django.template import loader, RequestContext
from django.contrib.auth.decorators import login_required
-from django.template import loader, RequestContext
-from django.shortcuts import render, redirect
def reset(request, reset_form, profile_model, template, key=None):
M webutils/djtools/auth_backends.py +3 -1
@@ 1,5 1,7 @@
from django.conf import settings
-from django.contrib.auth.models import User
+from django.contrib.auth import get_user_model
+
+User = get_user_model()
class EmailBackend(object):