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
3903eedc
Commit
3903eedc
authored
Jan 24, 2015
by
guanghongwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ȩ
parent
de175eb3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
6 deletions
+65
-6
views.py
jperm/views.py
+6
-2
perm_host.html
templates/jperm/perm_host.html
+59
-4
No files found.
jperm/views.py
View file @
3903eedc
...
...
@@ -2,7 +2,7 @@
from
django.shortcuts
import
render_to_response
from
django.http
import
HttpResponseRedirect
from
juser.models
import
User
from
juser.models
import
User
,
UserGroup
from
jasset.models
import
Asset
from
jperm.models
import
Perm
from
django.core.paginator
import
Paginator
,
EmptyPage
,
InvalidPage
...
...
@@ -11,7 +11,9 @@ from django.core.paginator import Paginator, EmptyPage, InvalidPage
def
perm_host
(
request
):
header_title
,
path1
,
path2
=
u'主机授权 | Perm Host Detail.'
,
u'jperm'
,
u'perm_host'
users
=
contact_list
=
User
.
objects
.
all
()
.
order_by
(
'id'
)
groups
=
contact_list2
=
UserGroup
.
objects
.
all
()
.
order_by
(
'id'
)
p
=
paginator
=
Paginator
(
contact_list
,
10
)
p2
=
paginator2
=
Paginator
(
contact_list2
,
10
)
try
:
page
=
int
(
request
.
GET
.
get
(
'page'
,
'1'
))
except
ValueError
:
...
...
@@ -19,9 +21,11 @@ def perm_host(request):
try
:
contacts
=
paginator
.
page
(
page
)
contacts2
=
paginator2
.
page
(
page
)
except
(
EmptyPage
,
InvalidPage
):
contacts
=
paginator
.
page
(
paginator
.
num_pages
)
return
render_to_response
(
'jperm/perm_host.html'
,
locals
(),)
contacts2
=
paginator2
.
page
(
paginator2
.
num_pages
)
return
render_to_response
(
'jperm/perm_host.html'
,
locals
())
def
perm_add
(
request
):
...
...
templates/jperm/perm_host.html
View file @
3903eedc
...
...
@@ -29,11 +29,7 @@
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
target=
"_blank"
href=
"/jperm/perm_edit/"
class=
"btn btn-sm btn-primary "
>
添加
</a>
</div>
<div
class=
"panel blank-panel"
>
<div
class=
"panel-heading"
>
<div
class=
"panel-options"
>
<ul
class=
"nav nav-tabs"
>
...
...
@@ -113,6 +109,65 @@
</div>
<div
id=
"tab-2"
class=
"tab-pane"
>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
<th
class=
"text-center"
>
组名
</th>
<th
class=
"text-center"
>
备注
</th>
<th
class=
"text-center"
>
操作
</th>
</tr>
</thead>
<tbody>
{% for group in contacts2.object_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
{{ group.name }}
</td>
<td
class=
"text-center"
>
{{ group.comment }}
</td>
<td
class=
"text-center"
>
<a
href=
"../perm_detail/?id={{ user.id }}"
class=
"iframe btn btn-xs btn-primary"
>
详情
</a>
<a
href=
"../perm_edit/?id={{ user.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
<div
class=
"dataTables_info"
id=
"editable_info"
role=
"status"
aria-live=
"polite"
>
Showing {{ contacts2.start_index }} to {{ contacts2.end_index }} of {{ p2.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 contacts2.has_previous %}
<li
class=
"paginate_button previous"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_previous"
>
<a
href=
"?page={{ contacts2.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 p2.page_range %}
{% ifequal offset1 page %}
<li
class=
"paginate_button active"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page2 }}"
title=
"第{{ page2 }}页"
>
{{ page2 }}
</a></li>
{% else %}
<li
class=
"paginate_button"
aria-controls=
"editable"
tabindex=
"0"
><a
href=
"?page={{ page2 }}"
title=
"第{{ page2 }}页"
>
{{ page2 }}
</a></li>
{% endifequal %}
{% endfor %}
{% if contacts2.has_next %}
<li
class=
"paginate_button next"
aria-controls=
"editable"
tabindex=
"0"
id=
"editable_next"
>
<a
href=
"?page={{ contacts2.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>
</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