diff --git a/xadmin/plugins/auth.py b/xadmin/plugins/auth.py index c18f9c2dd..fb42fe12d 100644 --- a/xadmin/plugins/auth.py +++ b/xadmin/plugins/auth.py @@ -4,6 +4,7 @@ AdminPasswordChangeForm, PasswordChangeForm) from django.contrib.auth.models import Group, Permission from django.core.exceptions import PermissionDenied +from django.conf import settings from django.template.response import TemplateResponse from django.utils.decorators import method_decorator from django.http import HttpResponseRedirect @@ -11,12 +12,13 @@ from django.utils.translation import ugettext as _ from django.views.decorators.debug import sensitive_post_parameters from django.forms import ModelMultipleChoiceField -from django.contrib.auth.models import User +from django.contrib.auth import get_user_model from xadmin.layout import Fieldset, Main, Side, Row, FormHelper from xadmin.sites import site from xadmin.util import unquote from xadmin.views import BaseAdminPlugin, ModelFormAdminView, ModelAdminView, CommAdminView, csrf_protect_m +User = get_user_model() ACTION_NAME = { 'add': _('Can add %s'), @@ -258,7 +260,9 @@ def post(self, request): else: return self.get_response() -site.register_view(r'^auth/user/(.+)/password/$', + +user_model = settings.AUTH_USER_MODEL.lower().replace('.','/') +site.register_view(r'^%s/(.+)/password/$' % user_model, ChangePasswordView, name='user_change_password') site.register_view(r'^account/password/$', ChangeAccountPasswordView, name='account_password')