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
cbf8dac5
Commit
cbf8dac5
authored
Mar 07, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改显示分页
parent
c0eec734
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
112 deletions
+7
-112
views.py
juser/views.py
+4
-35
group_list.html
templates/juser/group_list.html
+1
-38
user_list.html
templates/juser/user_list.html
+2
-39
No files found.
juser/views.py
View file @
cbf8dac5
...
...
@@ -22,7 +22,7 @@ from juser.models import UserGroup, User, DEPT
from
connect
import
PyCrypt
,
KEY
from
connect
import
BASE_DIR
from
connect
import
CONF
from
jumpserver.views
import
md5_crypt
,
LDAPMgmt
,
LDAP_ENABLE
,
ldap_conn
,
page_list_return
from
jumpserver.views
import
md5_crypt
,
LDAPMgmt
,
LDAP_ENABLE
,
ldap_conn
,
page_list_return
,
pages
from
jumpserver.api
import
user_perm_group_api
if
LDAP_ENABLE
:
...
...
@@ -231,19 +231,9 @@ def dept_list(request):
contact_list
=
DEPT
.
objects
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
.
order_by
(
'name'
)
else
:
contact_list
=
DEPT
.
objects
.
filter
(
id__gt
=
1
)
p
=
paginator
=
Paginator
(
contact_list
,
10
)
try
:
current_page
=
int
(
request
.
GET
.
get
(
'page'
,
'1'
))
except
ValueError
:
current_page
=
1
page_range
=
page_list_return
(
len
(
p
.
page_range
),
current_page
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
try
:
contacts
=
paginator
.
page
(
current_page
)
except
(
EmptyPage
,
InvalidPage
):
contacts
=
paginator
.
page
(
paginator
.
num_pages
)
return
render_to_response
(
'juser/dept_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
@@ -375,19 +365,8 @@ def group_list(request):
contact_list
=
UserGroup
.
objects
.
filter
(
Q
(
name__icontains
=
keyword
)
|
Q
(
comment__icontains
=
keyword
))
else
:
contact_list
=
UserGroup
.
objects
.
all
()
.
order_by
(
'name'
)
p
=
paginator
=
Paginator
(
contact_list
,
10
)
try
:
current_page
=
int
(
request
.
GET
.
get
(
'page'
,
'1'
))
except
ValueError
:
current_page
=
1
page_range
=
page_list_return
(
len
(
p
.
page_range
),
current_page
)
try
:
contacts
=
paginator
.
page
(
current_page
)
except
(
EmptyPage
,
InvalidPage
):
contacts
=
paginator
.
page
(
paginator
.
num_pages
)
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
return
render_to_response
(
'juser/group_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
@@ -531,19 +510,9 @@ def user_list(request):
contact_list
=
User
.
objects
.
filter
(
Q
(
username__icontains
=
keyword
)
|
Q
(
name__icontains
=
keyword
))
.
order_by
(
'name'
)
else
:
contact_list
=
User
.
objects
.
all
()
.
order_by
(
'id'
)
p
=
paginator
=
Paginator
(
contact_list
,
10
)
try
:
current_page
=
int
(
request
.
GET
.
get
(
'page'
,
'1'
))
except
ValueError
:
current_page
=
1
contact_list
,
p
,
contacts
,
page_range
,
current_page
,
show_first
,
show_end
=
pages
(
contact_list
,
request
)
page_range
=
page_list_return
(
len
(
p
.
page_range
),
current_page
)
try
:
contacts
=
paginator
.
page
(
current_page
)
except
(
EmptyPage
,
InvalidPage
):
contacts
=
paginator
.
page
(
paginator
.
num_pages
)
return
render_to_response
(
'juser/user_list.html'
,
locals
(),
context_instance
=
RequestContext
(
request
))
...
...
templates/juser/group_list.html
View file @
cbf8dac5
...
...
@@ -76,44 +76,7 @@
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.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 contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?page={{ contacts.previous_page_number }}"
>
Previous
</a>
</li>
{% else %}
<li
class=
"paginate_button previous disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"#"
>
Previous
</a>
</li>
{% endif %}
{% 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 %}
{% if contacts.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"?page={{ contacts.next_page_number }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"#"
>
Next
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% include 'paginator.html' %}
</div>
</div>
</div>
...
...
templates/juser/user_list.html
View file @
cbf8dac5
...
...
@@ -5,7 +5,7 @@
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"col-lg-1
0
"
>
<div
class=
"col-lg-1
2
"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
查看用户
</h5>
...
...
@@ -80,44 +80,7 @@
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ contacts.start_index }} to {{ contacts.end_index }} of {{ p.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 contacts.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?page={{ contacts.previous_page_number }}"
>
Previous
</a>
</li>
{% else %}
<li
class=
"paginate_button previous disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"#"
>
Previous
</a>
</li>
{% endif %}
{% 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 %}
{% if contacts.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"?page={{ contacts.next_page_number }}"
>
Next
</a>
</li>
{% else %}
<li
class=
"paginate_button next disabled"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"#"
>
Next
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
{% include 'paginator.html' %}
</div>
</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