From cc72d599652d9c81c7a2ce3f352782df278c73f4 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 22 Jan 2015 22:26:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jumpserver/templatetags/mytags.py | 8 ++++++++ juser/views.py | 6 +++--- templates/juser/user_list.html | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/jumpserver/templatetags/mytags.py b/jumpserver/templatetags/mytags.py index 86f978571..4c4045254 100644 --- a/jumpserver/templatetags/mytags.py +++ b/jumpserver/templatetags/mytags.py @@ -38,3 +38,11 @@ def groups_str(username): @register.filter(name='get_item') def get_item(dictionary, key): return dictionary.get(key) + + +@register.filter(name='bool2str') +def bool2str(value): + if value: + return u'是' + else: + return u'否' \ No newline at end of file diff --git a/juser/views.py b/juser/views.py index 5f1691449..236cf68a7 100644 --- a/juser/views.py +++ b/juser/views.py @@ -153,9 +153,9 @@ def group_list(request): def user_list(request): user_role = {'SU': u'超级管理员', 'GA': u'组管理员', 'CU': u'普通用户'} - header_title, path1, path2 = '查看用户 | Add User', 'juser', 'user_list' - users = contact_list = User.objects.all() - p = paginator = Paginator(contact_list, 5) + header_title, path1, path2 = '查看用户 | Show User', 'juser', 'user_list' + users = contact_list = User.objects.all().order_by('id') + p = paginator = Paginator(contact_list, 10) try: page = int(request.GET.get('page', '1')) diff --git a/templates/juser/user_list.html b/templates/juser/user_list.html index baa49717a..e14f80f4a 100644 --- a/templates/juser/user_list.html +++ b/templates/juser/user_list.html @@ -44,6 +44,7 @@ 角色 Email 激活 + 操作 @@ -56,7 +57,7 @@ {{ user.username|groups_str }} {{ user.id|get_role }} {{ user.email }} - {{ user.is_active }} + {{ user.is_active|bool2str }} 详情 编辑