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
f592e464
Commit
f592e464
authored
Jan 14, 2015
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加用户列表
parent
2200783d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
5 deletions
+28
-5
mytags.py
jumpserver/templatetags/mytags.py
+13
-0
views.py
juser/views.py
+1
-0
user_list.html
templates/juser/user_list.html
+14
-5
No files found.
jumpserver/templatetags/mytags.py
View file @
f592e464
...
...
@@ -15,3 +15,15 @@ def stamp2str(value):
@register.filter
(
name
=
'int2str'
)
def
int2str
(
value
):
return
str
(
value
)
@register.filter
(
name
=
'get_value'
)
def
get_value
(
dicts
,
key
):
return
dicts
.
get
(
key
,
''
)
@register.filter
(
name
=
'groups_str'
)
def
groups_str
(
group_list
):
groups
=
[]
for
group
in
group_list
:
groups
.
append
(
group
.
name
)
return
','
.
join
(
groups
)
\ No newline at end of file
juser/views.py
View file @
f592e464
...
...
@@ -152,6 +152,7 @@ def group_list(request):
def
user_list
(
request
):
user_role
=
{
'SU'
:
u'超级管理员'
,
'GA'
:
u'组管理员'
,
'CU'
:
u'普通用户'
}
header_title
,
path1
,
path2
=
'查看用户 | Add User'
,
'juser'
,
'user_list'
users
=
User
.
objects
.
all
()
return
render_to_response
(
'juser/user_list.html'
,
locals
())
...
...
templates/juser/user_list.html
View file @
f592e464
{% extends 'base.html' %}
{% load mytags %}
{% block content %}
{% include 'nav_cat_bar.html' %}
...
...
@@ -39,19 +40,27 @@
<th>
ID
</th>
<th>
用户名
</th>
<th>
姓名
</th>
<th>
属组
</th>
<th>
角色
</th>
<th>
Email
</th>
<th>
激活
</th>
</tr>
</thead>
<tbody>
{% for
group in group
s %}
{% for
user in user
s %}
<tr>
<td>
<div
class=
"checkbox i-checks"
>
<input
type=
"checkbox"
value=
"{{
group
.id }}"
name=
"selected"
>
<input
type=
"checkbox"
value=
"{{
user
.id }}"
name=
"selected"
>
</div>
</td>
<td>
{{ group.id }}
</td>
<td>
{{ group.name }}
</td>
<td>
{{ group.comment }}
</td>
<td>
{{ user.id }}
</td>
<td>
{{ user.username }}
</td>
<td>
{{ user.name }}
</td>
<td>
{{ user.user_group.all|groups_str }}
</td>
<td>
{{ user_roler|get_value:user.role }}
</td>
<td>
{{ user.email }}
</td>
<td>
{{ user.is_active }}
</td>
</tr>
{% endfor %}
</tbody>
...
...
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