From 66db6d52d0303c1231d7cb954f04c9be4140a82b Mon Sep 17 00:00:00 2001 From: xianbu Date: Wed, 28 Mar 2018 10:23:51 +0800 Subject: [PATCH 01/11] fix --- xadmin/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xadmin/widgets.py b/xadmin/widgets.py index 8fba092ca..cb2c530f6 100644 --- a/xadmin/widgets.py +++ b/xadmin/widgets.py @@ -72,7 +72,7 @@ def __init__(self, attrs=None): forms.MultiWidget.__init__(self, widgets, attrs) def render(self, name, value, attrs=None): - input_html = [ht for ht in super(AdminSplitDateTime, self).render(name, value, attrs).split('\n') if ht != ''] + input_html = [ht for ht in super(AdminSplitDateTime, self).render(name, value, attrs).split('>') if ht != ''] # return input_html return mark_safe('
%s' '
' From e4fe16378a075a7975c34603f47d7ac297625a34 Mon Sep 17 00:00:00 2001 From: xiandian Date: Fri, 30 Mar 2018 08:52:21 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E5=AE=9A=E5=88=B6=E5=90=8E=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xadmin/adminx.py | 3 ++- xadmin/plugins/auth.py | 12 ++++++------ xadmin/sites.py | 2 +- xadmin/templates/xadmin/base_site.html | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/xadmin/adminx.py b/xadmin/adminx.py index e7a66e0ff..89c5c0344 100644 --- a/xadmin/adminx.py +++ b/xadmin/adminx.py @@ -29,4 +29,5 @@ def link(self, instance): search_fields = ['ip_addr', 'message'] model_icon = 'fa fa-cog' -xadmin.site.register(Log, LogAdmin) +# 暂时不需要修改记录 +# xadmin.site.register(Log, LogAdmin) diff --git a/xadmin/plugins/auth.py b/xadmin/plugins/auth.py index 1ab6f6110..57ec7e6ed 100644 --- a/xadmin/plugins/auth.py +++ b/xadmin/plugins/auth.py @@ -59,10 +59,10 @@ def get_field_attrs(self, db_field, **kwargs): class UserAdmin(object): change_user_password_template = None - list_display = ('username', 'email', 'first_name', 'last_name', 'is_staff') - list_filter = ('is_staff', 'is_superuser', 'is_active') - search_fields = ('username', 'first_name', 'last_name', 'email') - ordering = ('username',) + list_display = ('username', 'email', 'date_joined', 'is_admin') + list_filter = ('is_admin', 'is_active') + search_fields = ('username', 'introduce_by', 'date_joined', 'email') + ordering = ('email',) style_fields = {'user_permissions': 'm2m_transfer'} model_icon = 'fa fa-user' relfield_style = 'fk-ajax' @@ -118,9 +118,9 @@ def show_name(self, p): model_icon = 'fa fa-lock' list_display = ('show_name', ) -site.register(Group, GroupAdmin) +#site.register(Group, GroupAdmin) site.register(User, UserAdmin) -site.register(Permission, PermissionAdmin) +#site.register(Permission, PermissionAdmin) class UserFieldPlugin(BaseAdminPlugin): diff --git a/xadmin/sites.py b/xadmin/sites.py index fe5f4dae9..8f3557e8f 100644 --- a/xadmin/sites.py +++ b/xadmin/sites.py @@ -158,7 +158,7 @@ def has_permission(self, request): Returns True if the given HttpRequest has permission to view *at least one* page in the admin site. """ - return request.user.is_active and request.user.is_staff + return request.user.is_active and request.user.is_admin def check_dependencies(self): """ diff --git a/xadmin/templates/xadmin/base_site.html b/xadmin/templates/xadmin/base_site.html index 9045bad69..eafbc549b 100644 --- a/xadmin/templates/xadmin/base_site.html +++ b/xadmin/templates/xadmin/base_site.html @@ -12,7 +12,7 @@