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
f3ae7f00
Commit
f3ae7f00
authored
Mar 14, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ʱ
parent
56df1f69
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
17 deletions
+97
-17
urls.py
juser/urls.py
+1
-2
views.py
juser/views.py
+10
-13
dept_list.html
templates/juser/dept_list.html
+1
-1
user_list.html
templates/juser/user_list.html
+1
-1
paginator_new..html
templates/paginator_new..html
+84
-0
No files found.
juser/urls.py
View file @
f3ae7f00
...
...
@@ -7,7 +7,6 @@ urlpatterns = patterns('juser.views',
# url(r'^$', 'jumpserver.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
(
r'^dept_list/$'
,
'dept_list'
),
(
r'^dept_add/$'
,
'dept_add'
),
(
r'^dept_del/$'
,
'dept_del'
),
...
...
@@ -21,7 +20,7 @@ urlpatterns = patterns('juser.views',
(
r'^group_del_ajax/$'
,
'group_del_ajax'
),
(
r'^group_edit/$'
,
'group_edit'
),
(
r'^user_add/$'
,
'user_add'
),
(
r'^user_list/
(?P<option>\w*)/?
$'
,
'user_list'
),
(
r'^user_list/$'
,
'user_list'
),
(
r'^user_detail/$'
,
'user_detail'
),
(
r'^user_del/$'
,
'user_del'
),
(
r'^user_del_ajax/$'
,
'user_del_ajax'
),
...
...
juser/views.py
View file @
f3ae7f00
...
...
@@ -527,31 +527,28 @@ def user_add(request):
@require_admin
def
user_list
(
request
,
option
=
""
):
def
user_list
(
request
):
user_role
=
{
'SU'
:
u'超级管理员'
,
'GA'
:
u'组管理员'
,
'CU'
:
u'普通用户'
}
header_title
,
path1
,
path2
=
'查看用户'
,
'用户管理'
,
'用户列表'
keyword
=
request
.
GET
.
get
(
'keyword'
,
''
)
gid
=
request
.
GET
.
get
(
'gid'
,
''
)
did
=
request
.
GET
.
get
(
'did'
,
''
)
if
option
==
"search"
:
contact_list
=
User
.
objects
.
filter
(
Q
(
username__icontains
=
keyword
)
|
Q
(
name__icontains
=
keyword
))
.
order_by
(
'name'
)
elif
option
==
"group"
:
contact_list
=
User
.
objects
.
all
()
.
order_by
(
'name'
)
if
gid
:
user_group
=
UserGroup
.
objects
.
filter
(
id
=
gid
)
if
user_group
:
user_group
=
user_group
[
0
]
contact_list
=
user_group
.
user_set
.
all
()
.
order_by
(
'name'
)
else
:
contact_list
=
[]
elif
option
==
"dept"
:
contact_list
=
user_group
.
user_set
.
all
()
if
did
:
dept
=
DEPT
.
objects
.
filter
(
id
=
did
)
if
dept
:
dept
=
dept
[
0
]
contact_list
=
dept
.
user_set
.
all
()
.
order_by
(
'name'
)
else
:
contact_list
=
[]
else
:
print
option
contact_list
=
User
.
objects
.
all
()
.
order_by
(
'name'
)
if
keyword
:
contact_list
=
contact_list
.
filter
(
Q
(
username__icontains
=
keyword
)
|
Q
(
name__icontains
=
keyword
))
.
order_by
(
'name'
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
...
...
templates/juser/dept_list.html
View file @
f3ae7f00
...
...
@@ -65,7 +65,7 @@
<input
type=
"checkbox"
name=
"selected"
value=
"{{ dept.id }}"
>
</td>
<td
class=
"text-center"
>
{{ dept.name }}
</td>
<td
class=
"text-center"
>
{{ dept.id | dept_group_num}}
</td>
<td
class=
"text-center"
>
<a
href=
"/juser/"
>
{{ dept.id | dept_group_num}}
</a>
</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>
...
...
templates/juser/user_list.html
View file @
f3ae7f00
...
...
@@ -32,7 +32,7 @@
<div
class=
""
>
<a
target=
"_blank"
href=
"/juser/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=
"
./search/
"
class=
"pull-right mail-search"
>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
id=
"search_input"
name=
"keyword"
placeholder=
"Search"
>
<div
class=
"input-group-btn"
>
...
...
templates/paginator_new..html
0 → 100644
View file @
f3ae7f00
<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 keyword %}
{% if contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"?keyword={{ keyword }}&page={{ contacts.previous_page_number }}"
>
Previous
</a>
</li>
{% else %}
<li
class=
"paginate_button previous disabled"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"#"
>
Previous
</a>
</li>
{% endif %}
{% set href="" %}
{% if gid %}
{% set href=href+"
&
gid="+gid %}
{% endif %}
{% if did %}
{% set href=href+"
&
did="+did %}
{% endif %}
{% if keyword %}
{% set href=href+"
&
keyword"+keyword %}
{% endif %}
{% ifequal show_first 1 %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page=1{{ href }}"
title=
"第1页"
>
1...
</a></li>
{% endifequal %}
{% for page in page_range %}
{% ifequal current_page page %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}{{ href }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}{{ href }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% ifequal show_end 1 %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ p.num_pages }}{{ href }}"
title=
"第{{ page }}页"
>
...{{ p.num_pages }}
</a></li>
{% endifequal %}
{% if contacts.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"?page={{ contacts.next_page_number }}{{ href }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"#"
>
Next
</a>
</li>
{% endif %}
{% else %}
{% if contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"?page={{ contacts.previous_page_number }}{{ href }}"
>
Previous
</a>
</li>
{% else %}
<li
class=
"paginate_button previous disabled"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"#"
>
Previous
</a>
</li>
{% endif %}
{% ifequal show_first 1 %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page=1{{ href }}"
title=
"第1页"
>
1...
</a></li>
{% endifequal %}
{% for page in page_range %}
{% ifequal current_page page %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page }}"
title=
"第{{ page }}页"
>
{{ page }}
</a></li>
{% endifequal %}
{% endfor %}
{% ifequal show_end 1 %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ p.num_pages }}"
title=
"第{{ page }}页"
>
...{{ p.num_pages }}
</a></li>
{% endifequal %}
{% if contacts.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"?page={{ contacts.next_page_number }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
>
<a
href=
"#"
>
Next
</a>
</li>
{% endif %}
{% endif %}
</ul>
</div>
</div>
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