diff --git a/jumpserver/templatetags/mytags.py b/jumpserver/templatetags/mytags.py index b91c91ddb..bd2dc09db 100644 --- a/jumpserver/templatetags/mytags.py +++ b/jumpserver/templatetags/mytags.py @@ -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] diff --git a/templates/jperm/dept_perm_list.html b/templates/jperm/dept_perm_list.html index eb945cf3a..a4f3b7afa 100644 --- a/templates/jperm/dept_perm_list.html +++ b/templates/jperm/dept_perm_list.html @@ -58,8 +58,8 @@ {% for dept in contacts.object_list %}