pull/6/head
ibuler 10 years ago
parent 9dc7e953c9
commit cc72d59965

@ -38,3 +38,11 @@ def groups_str(username):
@register.filter(name='get_item') @register.filter(name='get_item')
def get_item(dictionary, key): def get_item(dictionary, key):
return dictionary.get(key) return dictionary.get(key)
@register.filter(name='bool2str')
def bool2str(value):
if value:
return u''
else:
return u''

@ -153,9 +153,9 @@ def group_list(request):
def user_list(request): def user_list(request):
user_role = {'SU': u'超级管理员', 'GA': u'组管理员', 'CU': u'普通用户'} user_role = {'SU': u'超级管理员', 'GA': u'组管理员', 'CU': u'普通用户'}
header_title, path1, path2 = '查看用户 | Add User', 'juser', 'user_list' header_title, path1, path2 = '查看用户 | Show User', 'juser', 'user_list'
users = contact_list = User.objects.all() users = contact_list = User.objects.all().order_by('id')
p = paginator = Paginator(contact_list, 5) p = paginator = Paginator(contact_list, 10)
try: try:
page = int(request.GET.get('page', '1')) page = int(request.GET.get('page', '1'))

@ -44,6 +44,7 @@
<th class="text-center">角色</th> <th class="text-center">角色</th>
<th class="text-center">Email</th> <th class="text-center">Email</th>
<th class="text-center">激活</th> <th class="text-center">激活</th>
<th class="text-center">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -56,7 +57,7 @@
<td class="text-center"> {{ user.username|groups_str }}</td> <td class="text-center"> {{ user.username|groups_str }}</td>
<td class="text-center">{{ user.id|get_role }}</td> <td class="text-center">{{ user.id|get_role }}</td>
<td class="text-center">{{ user.email }}</td> <td class="text-center">{{ user.email }}</td>
<td class="text-center">{{ user.is_active }}</td> <td class="text-center">{{ user.is_active|bool2str }}</td>
<td class="text-center"> <td class="text-center">
<a href="/juser/{{ user.username }}/" class="iframe btn btn-xs btn-primary">详情</a> <a href="/juser/{{ user.username }}/" class="iframe btn btn-xs btn-primary">详情</a>
<a href="/juser/user_edit/{{ user.username }}" class="btn btn-xs btn-info">编辑</a> <a href="/juser/user_edit/{{ user.username }}" class="btn btn-xs btn-info">编辑</a>

Loading…
Cancel
Save