Skip to content

Commit

Permalink
修改用户插件,可以自定义用户表结构
Browse files Browse the repository at this point in the history
  • Loading branch information
wgbbiao committed Apr 28, 2017
1 parent 8258644 commit da7701c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions xadmin/plugins/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
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
from django.utils.html import escape
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'),
Expand Down Expand Up @@ -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')

0 comments on commit da7701c

Please sign in to comment.