修改部门显示

pull/6/head
guanghongwei 10 years ago
parent b2c72221f7
commit d1f19a5cad

@ -83,8 +83,9 @@ def member_count(group_id):
group = UserGroup.objects.get(id=group_id)
return group.user_set.count()
@register.filter(name='dept_member')
def dept_member(dept_id):
@register.filter(name='dept_user_num')
def dept_user_num(dept_id):
dept = DEPT.objects.filter(id=dept_id)
if dept:
dept = dept[0]
@ -93,14 +94,24 @@ def dept_member(dept_id):
return 0
@register.filter(name='dept_group_num')
def dept_group_num(dept_id):
dept = DEPT.objects.filter(id=dept_id)
if dept:
dept = dept[0]
return dept.usergroup_set.all().count()
else:
return 0
@register.filter(name='perm_count')
def perm_count(group_id):
group = UserGroup.objects.get(id=group_id)
return group.perm_set.count()
@register.filter(name='dept_perm_count')
def dept_perm_count(dept_id):
@register.filter(name='dept_asset_num')
def dept_asset_num(dept_id):
dept = DEPT.objects.filter(id=dept_id)
if dept:
dept = dept[0]

@ -58,8 +58,8 @@
{% for dept in contacts.object_list %}
<tr class="gradeX">
<td class="text-center"> {{ dept.name }} </td>
<td class="text-center"> {{ dept.id | dept_member }} </td>
<td class="text-center"> {{ dept.id | dept_perm_count }} </td>
<td class="text-center"> {{ dept.id | dept_user_num }} </td>
<td class="text-center"> {{ dept.id | dept_asset_num }} </td>
<td class="text-center"> {{ dept.comment }} </td>
<td class="text-center">
<a title="[ {{ dept.name }} ] 鎴愬憳淇℃伅" href="../dept_detail/?id={{ dept.id }}" class="iframe btn btn-xs btn-primary">涓绘満</a>

@ -51,7 +51,9 @@
<input type="checkbox" id="select_all" onclick="selectAll()" name="select_all">
</th>
<th class="text-center">閮ㄩ棬鍚嶇О</th>
<th class="text-center">灏忕粍鏁扮洰</th>
<th class="text-center">鎴愬憳鏁扮洰</th>
<th class="text-center">涓绘満鏁扮洰</th>
<th class="text-center">澶囨敞</th>
<th class="text-center">鎿嶄綔</th>
</tr>
@ -63,10 +65,11 @@
<input type="checkbox" name="selected" value="{{ dept.id }}">
</td>
<td class="text-center"> {{ dept.name }} </td>
<td class="text-center"> {{ dept.id | dept_member }} </td>
<td class="text-center"> {{ dept.id | dept_group_num}} </td>
<td class="text-center"> {{ dept.id | dept_user_num}} </td>
<td class="text-center"> {{ dept.id | dept_asset_num}} </td>
<td class="text-center"> {{ dept.comment }} </td>
<td class="text-center">
<a href="../user_list/dept/?did={{ dept.id }}" class="btn btn-xs btn-primary">鎴愬憳</a>
<a href="../dept_edit/?id={{ dept.id }}" class="btn btn-xs btn-info">缂栬緫</a>
<a href="../dept_del/?id={{ dept.id }}" class="btn btn-xs btn-danger">鍒犻櫎</a>
</td>

Loading鈥
Cancel
Save