Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
1f3c0d00
Commit
1f3c0d00
authored
Aug 23, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change update batch, add _list_base.html
parent
3c3fda80
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
312 additions
and
211 deletions
+312
-211
_list_base.html
apps/templates/_list_base.html
+62
-0
_pagination.html
apps/templates/_pagination.html
+32
-34
forms.py
apps/users/forms.py
+1
-1
_user.html
apps/users/templates/users/_user.html
+1
-1
user_list.bak.html
apps/users/templates/users/user_list.bak.html
+92
-0
user_list.html
apps/users/templates/users/user_list.html
+65
-85
usergroup_add.html
apps/users/templates/users/usergroup_add.html
+6
-14
usergroup_list.html
apps/users/templates/users/usergroup_list.html
+52
-75
views.py
apps/users/views.py
+1
-1
No files found.
apps/templates/_list_base.html
0 → 100644
View file @
1f3c0d00
{% extends 'base.html' %}
{% load common_tags %}
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
{{ path2 }}
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapise-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
{# left button add #}
{% block content_left_head %} {% endblock %}
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
name=
"keyword"
placeholder=
"Search"
value=
"{{ keyword }}"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
搜索
</button>
</div>
</div>
</form>
</div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
{% block table_head %} {% endblock %}
</tr>
</thead>
<tbody>
{% block table_body %} {% endblock %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-4"
>
{# Update batch #}
{% block content_bottom_left %} {% endblock %}
</div>
{% include '_pagination.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
apps/templates/_pagination.html
View file @
1f3c0d00
{% load common_tags %}
{% if is_paginated %}
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ page_obj.start_index }} to {{ page_obj.end_index }} of {{ paginator.count }} entries
</div>
</div>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_paginate paging_simple_numbers"
id=
"editable_paginate"
>
<ul
class=
"pagination"
style=
"margin-top: 0; float: right"
>
{% if page_obj.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"previous"
>
<a
data-page=
"next"
href=
"?page={{ page_obj.previous_page_number}}"
>
‹
</a>
</li>
{% endif %}
{% if is_paginated %}
<div
class=
"col-sm-4"
>
<div
class=
"dataTables_info text-center"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ page_obj.start_index }} to {{ page_obj.end_index }} of {{ paginator.count }} entries
</div>
</div>
<div
class=
"col-sm-4"
>
<div
class=
"dataTables_paginate paging_simple_numbers"
id=
"editable_paginate"
>
<ul
class=
"pagination"
style=
"margin-top: 0; float: right"
>
{% if page_obj.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"previous"
>
<a
data-page=
"next"
href=
"?page={{ page_obj.previous_page_number}}"
>
‹
</a>
</li>
{% endif %}
{% for page in paginator.num_pages|pagination_range:page_obj.number %}
{% if page == page_obj.number %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
>
{% endif %}
<a
class=
"page"
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a>
</li>
{% endfor %}
{% for page in paginator.num_pages|pagination_range:page_obj.number %}
{% if page == page_obj.number %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
>
{% endif %}
<a
class=
"page"
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a>
</li>
{% endfor %}
{% if page_obj.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"next"
>
<a
data-page=
"next"
href=
"?page={{ page_obj.next_page_number }}"
>
›
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endif %}
{% if page_obj.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"next"
>
<a
data-page=
"next"
href=
"?page={{ page_obj.next_page_number }}"
>
›
</a>
</li>
{% endif %}
</ul>
</div>
</div>
{% endif %}
<script>
function
sleep
(
n
)
{
//n表示的毫秒数
var
start
=
new
Date
().
getTime
();
...
...
apps/users/forms.py
View file @
1f3c0d00
...
...
@@ -40,7 +40,7 @@ class UserUpdateForm(ModelForm):
}
widgets
=
{
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'
chosen-select
'
,
'data-placeholder'
:
'请选择用户组'
}),
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'
select2
'
,
'data-placeholder'
:
'请选择用户组'
}),
}
...
...
apps/users/templates/users/_user.html
View file @
1f3c0d00
...
...
@@ -3,8 +3,8 @@
{% load bootstrap %}
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
select2
/
select2
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
datepicker
/
datepicker3
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
plugins
/
select2
/
select2
.
full
.
min
.
js
"
%}"
></script>
<link
href=
"{% static "
css
/
plugins
/
datepicker
/
datepicker3
.
css
"
%}"
rel=
"stylesheet"
>
{% endblock %}
{% block content %}
...
...
apps/users/templates/users/user_list.bak.html
0 → 100644
View file @
1f3c0d00
{% extends '_list_base.html' %}
{% load common_tags %}
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
查看用户
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapise-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
href=
"{% url 'users:user-add' %}"
class=
"btn btn-sm btn-primary "
>
添加用户
</a>
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger "
>
删除所选
</a>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
name=
"keyword"
placeholder=
"用户名或姓名"
value=
"{{ keyword }}"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
搜索
</button>
</div>
</div>
</form>
</div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=name"
>
姓名
</a></th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=username"
>
用户名
</a></th>
<th
class=
"text-center"
>
角色
</th>
<th
class=
"text-center"
>
用户组
</th>
<th
class=
"text-center"
>
资产数量
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=date_expired"
>
有效
</a></th>
<th
class=
"text-center"
></th>
</tr>
</thead>
<tbody>
{% for user in user_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
name=
"checked"
value=
"{{ user.id }}"
>
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-detail' pk=user.id %}"
>
{{ user.name }}
</a>
</td>
<td
class=
"text-center"
>
{{ user.username }}
</td>
<td
class=
"text-center"
>
{{ user.role.name }}
</td>
<td
class=
"text-center"
title=
"{% for user_group in user.group.all %} {{ user_group.name }} {% endfor %}"
>
{{ user.groups.all|join_queryset_attr:"name" }}
</td>
<th
class=
"text-center"
>
{{ user.name }}
</th>
<td
class=
"text-center"
>
{% if user.is_expired %}
<i
class=
"fa fa-times text-danger"
></i>
{% else %}
<i
class=
"fa fa-check text-navy"
></i>
{% endif %}
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-edit' pk=user.id %}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"{% url 'users:user-delete' pk=user.id %}"
class=
"btn btn-xs btn-danger del {% if user.username == 'admin' %} disabled {% endif %}"
>
删除
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
</div>
{% include '_pagination.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
apps/users/templates/users/user_list.html
View file @
1f3c0d00
{% extends 'base.html' %}
{% extends '
_list_
base.html' %}
{% load common_tags %}
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
查看用户
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapise-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
{% block content_left_head %}
<a
href=
"{% url 'users:user-add' %}"
class=
"btn btn-sm btn-primary "
>
添加用户
</a>
{#
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger "
>
删除所选
</a>
#}
{% endblock %}
{% block table_head %}
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=name"
>
姓名
</a></th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=username"
>
用户名
</a></th>
<th
class=
"text-center"
>
角色
</th>
<th
class=
"text-center"
>
用户组
</th>
<th
class=
"text-center"
>
资产数量
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=date_expired"
>
有效
</a></th>
<th
class=
"text-center"
></th>
{% endblock %}
{% block table_body %}
{% for user in user_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
name=
"checked"
value=
"{{ user.id }}"
>
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-detail' pk=user.id %}"
>
{{ user.name }}
</a>
</td>
<td
class=
"text-center"
>
{{ user.username }}
</td>
<td
class=
"text-center"
>
{{ user.role.name }}
</td>
<td
class=
"text-center"
title=
"{% for user_group in user.group.all %} {{ user_group.name }} {% endfor %}"
>
{{ user.groups.all|join_queryset_attr:"name" }}
</td>
<th
class=
"text-center"
>
{{ user.name }}
</th>
<td
class=
"text-center"
>
{% if user.is_expired %}
<i
class=
"fa fa-times text-danger"
></i>
{% else %}
<i
class=
"fa fa-check text-navy"
></i>
{% endif %}
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-edit' pk=user.id %}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"{% url 'users:user-delete' pk=user.id %}"
class=
"btn btn-xs btn-danger del {% if user.username == 'admin' %} disabled {% endif %}"
>
删除
</a>
</td>
</tr>
{% endfor %}
{% endblock %}
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
href=
"{% url 'users:user-add' %}"
class=
"btn btn-sm btn-primary "
>
添加用户
</a>
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger "
>
删除所选
</a>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
name=
"keyword"
placeholder=
"用户名或姓名"
value=
"{{ keyword }}"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
搜索
</button>
</div>
</div>
</form>
</div>
{% block content_bottom_left %}
<form
id=
""
method=
"get"
action=
""
class=
" mail-search"
>
<div
class=
"input-group"
>
<select
class=
"form-control m-b"
style=
"width: auto"
>
<option>
批量删除
</option>
<option>
批量更新
</option>
<option>
批量禁用
</option>
<option>
批量导出
</option>
</select>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=name"
>
姓名
</a></th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=username"
>
用户名
</a></th>
<th
class=
"text-center"
>
角色
</th>
<th
class=
"text-center"
>
用户组
</th>
<th
class=
"text-center"
>
资产数量
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=date_expired"
>
有效
</a></th>
<th
class=
"text-center"
></th>
</tr>
</thead>
<tbody>
{% for user in user_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
name=
"checked"
value=
"{{ user.id }}"
>
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-detail' pk=user.id %}"
>
{{ user.name }}
</a>
</td>
<td
class=
"text-center"
>
{{ user.username }}
</td>
<td
class=
"text-center"
>
{{ user.role.name }}
</td>
<td
class=
"text-center"
title=
"{% for user_group in user.group.all %} {{ user_group.name }} {% endfor %}"
>
{{ user.groups.all|join_queryset_attr:"name" }}
</td>
<th
class=
"text-center"
>
{{ user.name }}
</th>
<td
class=
"text-center"
>
{% if user.is_expired %}
<i
class=
"fa fa-times text-danger"
></i>
{% else %}
<i
class=
"fa fa-check text-navy"
></i>
{% endif %}
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-edit' pk=user.id %}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"{% url 'users:user-delete' pk=user.id %}"
class=
"btn btn-xs btn-danger del {% if user.username == 'admin' %} disabled {% endif %}"
>
删除
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include '_pagination.html' %}
</div>
<div
class=
"input-group-btn pull-left"
style=
"padding-left: 5px;"
>
<button
id=
'search_btn'
type=
"submit"
style=
"height: 32px;"
class=
"btn btn-sm btn-primary"
>
确认
</button>
</div>
</div>
</div>
</div>
</div>
</form>
{% endblock %}
apps/users/templates/users/usergroup_add.html
View file @
1f3c0d00
...
...
@@ -2,8 +2,8 @@
{% load static %}
{% load bootstrap %}
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
chosen
/
chose
n
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
plugins
/
chosen
/
chosen
.
jquery
.
min
.
js
"
%}"
></script>
<link
href=
"{% static "
css
/
plugins
/
select2
/
select2
.
mi
n
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
plugins
/
select2
/
select2
.
full
.
min
.
js
"
%}"
></script>
{% endblock %}
{% block content %}
...
...
@@ -32,8 +32,8 @@
<div
class=
"form-group"
>
<label
for=
"users"
class=
"col-sm-2 control-label"
>
用户
</label>
<div
class=
"col-sm-
8
"
>
<select
name=
"users"
id=
"users"
data-placeholder=
"选择用户"
class=
"
chosen-select
form-control m-b"
multiple
tabindex=
"2"
>
<div
class=
"col-sm-
9
"
>
<select
name=
"users"
id=
"users"
data-placeholder=
"选择用户"
class=
"
select2
form-control m-b"
multiple
tabindex=
"2"
>
{% for user in users %}
<option
value=
"{{ user.id }}"
>
{{ user.name }}
</option>
{% endfor %}
...
...
@@ -59,16 +59,7 @@
{% block custom_foot_js %}
<script>
$
(
document
).
ready
(
function
()
{
var
config
=
{
'.chosen-select'
:
{},
'.chosen-select-deselect'
:
{
allow_single_deselect
:
true
},
'.chosen-select-no-single'
:
{
disable_search_threshold
:
10
},
'.chosen-select-no-results'
:
{
no_results_text
:
'Oops, nothing found!'
},
'.chosen-select-width'
:
{
width
:
"95%"
}
};
for
(
var
selector
in
config
)
{
$
(
selector
).
chosen
(
config
[
selector
]);
}
$
(
'.select2'
).
select2
();
})
</script>
{% endblock %}
\ No newline at end of file
apps/users/templates/users/usergroup_list.html
View file @
1f3c0d00
{% extends 'base.html' %}
{% extends '
_list_
base.html' %}
{% load common_tags %}
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
查看用户组
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapise-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
{% block content_left_head %}
<a
href=
"{% url 'users:usergroup-add' %}"
class=
"btn btn-sm btn-primary "
>
添加用户组
</a>
{% endblock %}
{% block table_head %}
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:usergroup-list' %}?sort=name"
>
名称
</a></th>
<th
class=
"text-center"
>
用户数量
</th>
<th
class=
"text-center"
>
资产数量
</th>
<th
class=
"text-center"
>
描述
</th>
<th
class=
"text-center"
></th>
{% endblock %}
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
href=
"{% url 'users:usergroup-add' %}"
class=
"btn btn-sm btn-primary "
>
添加用户组
</a>
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger "
>
删除所选
</a>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
name=
"keyword"
placeholder=
"名称"
value=
"{{ keyword }}"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
搜索
</button>
</div>
</div>
</form>
</div>
{% block table_body %}
{% for usergroup in usergroup_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
name=
"checked"
value=
"{{ usergroup.id }}"
>
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:usergroup-detail' pk=usergroup.id %}"
>
{{ usergroup.name }}
</a>
</td>
<td
class=
"text-center"
>
{{ usergroup.user_set.all|length }}
</td>
<td
class=
"text-center"
>
数量
</td>
<th
class=
"text-center"
>
{{ usergroup.comment|truncatewords:8 }}
</th>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:usergroup-edit' pk=usergroup.id %}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"{% url 'users:usergroup-delete' pk=usergroup.id %}"
class=
"btn btn-xs btn-danger del"
>
删除
</a>
</td>
</tr>
{% endfor %}
{% endblock %}
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:usergroup-list' %}?sort=name"
>
名称
</a></th>
<th
class=
"text-center"
>
用户数量
</th>
<th
class=
"text-center"
>
资产数量
</th>
<th
class=
"text-center"
>
描述
</th>
<th
class=
"text-center"
></th>
</tr>
</thead>
<tbody>
{% for usergroup in usergroup_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
name=
"checked"
value=
"{{ usergroup.id }}"
>
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:usergroup-detail' pk=usergroup.id %}"
>
{{ usergroup.name }}
</a>
</td>
<td
class=
"text-center"
>
{{ usergroup.user_set.all|length }}
</td>
<td
class=
"text-center"
>
数量
</td>
<th
class=
"text-center"
>
{{ usergroup.comment|truncatewords:8 }}
</th>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:usergroup-edit' pk=usergroup.id %}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"{% url 'users:usergroup-delete' pk=usergroup.id %}"
class=
"btn btn-xs btn-danger del"
>
删除
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% include '_pagination.html' %}
</div>
{% block content_bottom_left %}
<form
id=
""
method=
"get"
action=
""
class=
" mail-search"
>
<div
class=
"input-group"
>
<select
class=
"form-control m-b"
style=
"width: auto"
>
<option>
批量删除
</option>
<option>
批量更新
</option>
<option>
批量禁用
</option>
<option>
批量导出
</option>
</select>
<div
class=
"input-group-btn pull-left"
style=
"padding-left: 5px;"
>
<button
id=
'search_btn'
type=
"submit"
style=
"height: 32px;"
class=
"btn btn-sm btn-primary"
>
确认
</button>
</div>
</div>
</div>
</div>
</form>
{% endblock %}
apps/users/views.py
View file @
1f3c0d00
...
...
@@ -107,7 +107,7 @@ class UserDetailView(DetailView):
class
UserGroupListView
(
ListView
):
model
=
UserGroup
paginate_by
=
20
paginate_by
=
settings
.
CONFIG
.
DISPLAY_PER_PAGE
context_object_name
=
'usergroup_list'
template_name
=
'users/usergroup_list.html'
ordering
=
'-date_added'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment