添加用户列表

pull/6/head
ibuler 2015-01-14 23:51:30 +08:00
parent 2200783de7
commit f592e46442
3 changed files with 27 additions and 5 deletions

View File

@ -15,3 +15,15 @@ def stamp2str(value):
@register.filter(name='int2str')
def int2str(value):
return str(value)
@register.filter(name='get_value')
def get_value(dicts, key):
return dicts.get(key, '')
@register.filter(name='groups_str')
def groups_str(group_list):
groups = []
for group in group_list:
groups.append(group.name)
return ','.join(groups)

View File

@ -152,6 +152,7 @@ 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 = User.objects.all()
return render_to_response('juser/user_list.html', locals())

View File

@ -1,4 +1,5 @@
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
@ -39,19 +40,27 @@
<th>ID</th>
<th>用户名</th>
<th>姓名</th>
<th>属组</th>
<th>角色</th>
<th>Email</th>
<th>激活</th>
</tr>
</thead>
<tbody>
{% for group in groups %}
{% for user in users %}
<tr>
<td>
<div class="checkbox i-checks">
<input type="checkbox" value="{{ group.id }}" name="selected">
<input type="checkbox" value="{{ user.id }}" name="selected">
</div>
</td>
<td>{{ group.id }}</td>
<td>{{ group.name }}</td>
<td>{{ group.comment }}</td>
<td>{{ user.id }}</td>
<td>{{ user.username }}</td>
<td>{{ user.name }}</td>
<td>{{ user.user_group.all|groups_str }}</td>
<td>{{ user_roler|get_value:user.role }}</td>
<td>{{ user.email }}</td>
<td>{{ user.is_active }}</td>
</tr>
{% endfor %}
</tbody>