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
641e9985
Commit
641e9985
authored
Aug 25, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update context name path1, path2 => app, action
parent
0a9e4a5e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
39 deletions
+33
-39
_header_bar.html
apps/templates/_header_bar.html
+5
-5
_list_base.html
apps/templates/_list_base.html
+1
-1
_nav.html
apps/templates/_nav.html
+2
-2
api_urls.py
apps/users/api_urls.py
+0
-14
user_detail.html
apps/users/templates/users/user_detail.html
+5
-2
urls.py
apps/users/urls.py
+10
-10
views.py
apps/users/views.py
+10
-5
No files found.
apps/templates/_header_bar.html
View file @
641e9985
...
...
@@ -28,19 +28,19 @@
<div
class=
"row wrapper border-bottom white-bg page-heading"
>
<div
class=
"col-sm-10"
>
<h2>
{{ title }}
</h2>
<h2></h2>
<ol
class=
"breadcrumb"
>
<li>
<a
href=
""
>
仪表盘
</a>
</li>
<li>
{% if
path1
%}
<a>
{{
path1
}}
</a>
{% if
app
%}
<a>
{{
app
}}
</a>
{% endif %}
</li>
{% if
path2
%}
{% if
action
%}
<li
class=
"active"
>
<strong>
{{
path2
}}
</strong>
<strong>
{{
action
}}
</strong>
</li>
{% endif %}
</ol>
...
...
apps/templates/_list_base.html
View file @
641e9985
...
...
@@ -6,7 +6,7 @@
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
{{
path2
}}
</h5>
<h5>
{{
action
}}
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapise-link"
>
<i
class=
"fa fa-chevron-up"
></i>
...
...
apps/templates/_nav.html
View file @
641e9985
...
...
@@ -8,8 +8,8 @@
<i
class=
"fa fa-group"
></i>
<span
class=
"nav-label"
>
用户管理
</span><span
class=
"fa arrow"
></span>
</a>
<ul
class=
"nav nav-second-level active"
>
<li
class=
"user"
><a
href=
"{% url 'users:user-list' %}"
>
用户列表
</a></li>
<li
class=
"usergroup"
><a
href=
"{% url 'users:usergroup-list' %}"
>
用户组列表
</a></li>
<li
class=
"user
s
"
><a
href=
"{% url 'users:user-list' %}"
>
用户列表
</a></li>
<li
class=
"usergroup
s
"
><a
href=
"{% url 'users:usergroup-list' %}"
>
用户组列表
</a></li>
</ul>
</li>
<li
id=
""
>
...
...
apps/users/api_urls.py
deleted
100644 → 0
View file @
0a9e4a5e
# -*- coding: utf-8 -*-
#
from
django.conf.urls
import
url
,
include
import
api
app_name
=
'users'
urlpatterns
=
[
url
(
r'^v1/users/$'
,
api
.
UserListAddApi
.
as_view
(),
name
=
'user-list-api'
),
url
(
r'^v1/users/(?P<pk>[0-9]+)/$'
,
api
.
UserDetailDeleteUpdateApi
.
as_view
(),
name
=
'user-detail-api'
),
url
(
r'^v1/usergroups/$'
,
api
.
UserGroupListAddApi
.
as_view
(),
name
=
'usergroup-list-api'
),
url
(
r'^v1/usergroups/(?P<pk>[0-9]+)/$'
,
api
.
UserGroupDetailDeleteUpdateApi
.
as_view
(),
name
=
'usergroup-detail-api'
),
]
apps/users/templates/users/user_detail.html
View file @
641e9985
...
...
@@ -134,8 +134,11 @@
<td><span
style=
"float: right"
>
<div
class=
"switch"
>
<div
class=
"onoffswitch"
>
<input
type=
"checkbox"
checked
class=
"onoffswitch-checkbox"
id=
"example1"
>
{% if user.is_active %}
<input
type=
"checkbox"
checked
class=
"onoffswitch-checkbox"
id=
"example1"
>
{% else %}
<input
type=
"checkbox"
class=
"onoffswitch-checkbox"
id=
"example1"
>
{% endif %}
<label
class=
"onoffswitch-label"
for=
"example1"
>
<span
class=
"onoffswitch-inner"
></span>
<span
class=
"onoffswitch-switch"
></span>
...
...
apps/users/urls.py
View file @
641e9985
...
...
@@ -7,16 +7,16 @@ import api
app_name
=
'users'
urlpatterns
=
[
url
(
r'^user/$'
,
UserListView
.
as_view
(),
name
=
'user-list'
),
url
(
r'^user/(?P<pk>[0-9]+)/$'
,
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
url
(
r'^user/add/$'
,
UserAddView
.
as_view
(),
name
=
'user-add'
),
url
(
r'^user/(?P<pk>[0-9]+)/edit/$'
,
UserUpdateView
.
as_view
(),
name
=
'user-edit'
),
url
(
r'^user/(?P<pk>[0-9]+)/delete/$'
,
UserDeleteView
.
as_view
(),
name
=
'user-delete'
),
url
(
r'^usergroup/$'
,
UserGroupListView
.
as_view
(),
name
=
'usergroup-list'
),
url
(
r'^usergroup/(?P<pk>[0-9]+)/$'
,
UserGroupDetailView
.
as_view
(),
name
=
'usergroup-detail'
),
url
(
r'^usergroup/add/$'
,
UserGroupAddView
.
as_view
(),
name
=
'usergroup-add'
),
url
(
r'^usergroup/(?P<pk>[0-9]+)/edit/$'
,
UserGroupUpdateView
.
as_view
(),
name
=
'usergroup-edit'
),
url
(
r'^usergroup/(?P<pk>[0-9]+)/delete/$'
,
UserGroupDeleteView
.
as_view
(),
name
=
'usergroup-delete'
),
url
(
r'^user
s
/$'
,
UserListView
.
as_view
(),
name
=
'user-list'
),
url
(
r'^user
s
/(?P<pk>[0-9]+)/$'
,
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
url
(
r'^user
s
/add/$'
,
UserAddView
.
as_view
(),
name
=
'user-add'
),
url
(
r'^user
s
/(?P<pk>[0-9]+)/edit/$'
,
UserUpdateView
.
as_view
(),
name
=
'user-edit'
),
url
(
r'^user
s
/(?P<pk>[0-9]+)/delete/$'
,
UserDeleteView
.
as_view
(),
name
=
'user-delete'
),
url
(
r'^usergroup
s
/$'
,
UserGroupListView
.
as_view
(),
name
=
'usergroup-list'
),
url
(
r'^usergroup
s
/(?P<pk>[0-9]+)/$'
,
UserGroupDetailView
.
as_view
(),
name
=
'usergroup-detail'
),
url
(
r'^usergroup
s
/add/$'
,
UserGroupAddView
.
as_view
(),
name
=
'usergroup-add'
),
url
(
r'^usergroup
s
/(?P<pk>[0-9]+)/edit/$'
,
UserGroupUpdateView
.
as_view
(),
name
=
'usergroup-edit'
),
url
(
r'^usergroup
s
/(?P<pk>[0-9]+)/delete/$'
,
UserGroupDeleteView
.
as_view
(),
name
=
'usergroup-delete'
),
]
...
...
apps/users/views.py
View file @
641e9985
...
...
@@ -36,7 +36,7 @@ class UserListView(ListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserListView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'
path1'
:
'用户管理'
,
'path2'
:
'用户列表'
,
'title
'
:
'用户列表'
,
'keyword'
:
self
.
keyword
})
context
.
update
({
'
app'
:
'用户管理'
,
'action
'
:
'用户列表'
,
'keyword'
:
self
.
keyword
})
return
context
...
...
@@ -49,7 +49,7 @@ class UserAddView(SuccessMessageMixin, CreateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserAddView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'
path1'
:
'用户管理'
,
'path2'
:
'用户添加'
,
'title
'
:
'用户添加'
})
context
.
update
({
'
app'
:
'用户管理'
,
'action
'
:
'用户添加'
})
return
context
def
form_valid
(
self
,
form
):
...
...
@@ -87,6 +87,11 @@ class UserUpdateView(UpdateView):
print
(
form
.
errors
)
return
super
(
UserUpdateView
,
self
)
.
form_invalid
(
form
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserUpdateView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
'用户管理'
,
'action'
:
'用户编辑'
})
return
context
class
UserDeleteView
(
DeleteView
):
model
=
User
...
...
@@ -102,7 +107,7 @@ class UserDetailView(DetailView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
groups
=
[
group
for
group
in
UserGroup
.
objects
.
iterator
()
if
group
not
in
self
.
object
.
groups
.
iterator
()]
context
.
update
({
'
path1'
:
'用户管理'
,
'path2'
:
'用户详情'
,
'title
'
:
'用户详情'
,
'groups'
:
groups
})
context
.
update
({
'
app'
:
'用户管理'
,
'action
'
:
'用户详情'
,
'groups'
:
groups
})
return
context
...
...
@@ -126,7 +131,7 @@ class UserGroupListView(ListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserGroupListView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'
path1'
:
'用户管理'
,
'path2'
:
'用户组列表'
,
'title
'
:
'用户组列表'
,
'keyword'
:
self
.
keyword
})
context
.
update
({
'
app'
:
'用户管理'
,
'action
'
:
'用户组列表'
,
'keyword'
:
self
.
keyword
})
return
context
...
...
@@ -139,7 +144,7 @@ class UserGroupAddView(CreateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserGroupAddView
,
self
)
.
get_context_data
(
**
kwargs
)
users
=
User
.
objects
.
all
()
context
.
update
({
'
path1'
:
'用户管理'
,
'path2'
:
'用户组添加'
,
'title
'
:
'用户组添加'
,
'users'
:
users
})
context
.
update
({
'
app'
:
'用户管理'
,
'action
'
:
'用户组添加'
,
'users'
:
users
})
return
context
def
form_valid
(
self
,
form
):
...
...
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