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
651e8999
Commit
651e8999
authored
Aug 18, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify list and sort
parent
342298ad
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
11 deletions
+66
-11
datatables.min.css
apps/static/css/plugins/dataTables/datatables.min.css
+0
-0
style.css
apps/static/css/style.css
+1
-0
datatables.min.js
apps/static/js/plugins/dataTables/datatables.min.js
+0
-0
0009_auto_20160818_1444.py
apps/users/migrations/0009_auto_20160818_1444.py
+20
-0
user_detail.html
apps/users/templates/users/user_detail.html
+6
-4
user_list.html
apps/users/templates/users/user_list.html
+10
-4
tests.py
apps/users/tests.py
+24
-2
views.py
apps/users/views.py
+5
-1
No files found.
apps/static/css/plugins/dataTables/datatables.min.css
0 → 100755
View file @
651e8999
This diff is collapsed.
Click to expand it.
apps/static/css/style.css
View file @
651e8999
...
...
@@ -4600,3 +4600,4 @@ body.skin-3 {
border-width
:
1px
}
apps/static/js/plugins/dataTables/datatables.min.js
0 → 100755
View file @
651e8999
This diff is collapsed.
Click to expand it.
apps/users/migrations/0009_auto_20160818_1444.py
0 → 100644
View file @
651e8999
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-18 06:44
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0008_auto_20160817_2303'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'user'
,
name
=
'groups'
,
field
=
models
.
ManyToManyField
(
help_text
=
'* required'
,
to
=
'users.UserGroup'
,
verbose_name
=
'
\u7528\u6237\u7ec4
'
),
),
]
apps/users/templates/users/user_detail.html
View file @
651e8999
...
...
@@ -111,8 +111,8 @@
<td><b>
{{ user.last_login|date:"Y-m-j H:i:s" }}
</b></td>
</tr>
<tr>
<td>
描述:
</td>
<td><b>
{{ user.comment }}
</b></td>
<td
class=
"no-borders"
>
描述:
</td>
<td
class=
"no-borders"
><b>
{{ user.comment }}
</b></td>
</tr>
</tbody>
</table>
...
...
@@ -208,8 +208,10 @@
{% for group in user.groups.all %}
<tr>
<td
width=
"40%"
><b>
{{ group.name }}
</b></td>
<td></td>
<td
width=
"40%"
><b
style=
"font-size: medium"
>
{{ group.name }}
</b></td>
<td>
<button
class=
"btn btn-danger btn-sm"
type=
"button"
style=
"float: right;"
><i
class=
"fa fa-minus"
></i></button>
</td>
</tr>
{% endfor %}
</tbody>
...
...
apps/users/templates/users/user_list.html
View file @
651e8999
...
...
@@ -42,12 +42,12 @@
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
<th
class=
"text-center"
>
姓名
</th>
<th
class=
"text-center"
>
用户名
</th>
<th
class=
"text-center"
>
<a
href=
"{% url 'users:user-list' %}?sort=name"
>
姓名
</a>
</th>
<th
class=
"text-center"
>
<a
href=
"{% url 'users:user-list' %}?sort=username"
>
用户名
</a>
</th>
<th
class=
"text-center"
>
角色
</th>
<th
class=
"text-center"
>
用户组
</th>
<th
class=
"text-center"
>
资产数量
</th>
<th
class=
"text-center"
>
有效
</th>
<th
class=
"text-center"
>
<a
href=
"{% url 'users:user-list' %}?sort=date_expired"
>
有效
</a>
</th>
<th
class=
"text-center"
></th>
</tr>
</thead>
...
...
@@ -66,7 +66,13 @@
<td
class=
"text-center"
>
{{ user.role.name }}
</td>
<td
class=
"text-center"
title=
"{% for user_group in user.group.all %} {{ user_group.name }} {% endfor %}"
>
{{ user.groups.all|join_queryset_attr:"name" }}
</td>
<th
class=
"text-center"
>
{{ user.name }}
</th>
<td
class=
"text-center"
>
{{ user.date_expired|is_expired|yesno:"过期, 有效, 分不清楚" }}
</td>
<td
class=
"text-center"
>
{% if user.date_expired|is_expired %}
<i
class=
"fa fa-times text-danger"
></i>
{% else %}
<i
class=
"fa fa-check text-navy"
></i>
{% endif %}
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-edit' pk=user.id %}?id={{ user.id }}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"{% url 'users:user-delete' pk=user.id %}?id={{ user.id }}"
class=
"btn btn-xs btn-danger del {% if user.username == 'admin' %} disabled {% endif %}"
>
删除
</a>
...
...
apps/users/tests.py
View file @
651e8999
from
django.test
import
TestCase
import
forgery_py
from
django.test
import
TestCase
,
Client
from
django.test.utils
import
setup_test_environment
from
.models
import
User
,
UserGroup
setup_test_environment
()
client
=
Client
()
def
create_usergroup
(
name
):
pass
def
get_random_usergroup
():
pass
def
create_user
(
username
,
name
,
email
,
groups
):
pass
class
UserListViewTests
(
TestCase
):
# Create your tests here.
apps/users/views.py
View file @
651e8999
...
...
@@ -12,7 +12,7 @@ from .forms import UserAddForm, UserUpdateForm
class
UserListView
(
ListView
):
model
=
User
paginate_by
=
1
0
paginate_by
=
2
0
context_object_name
=
'user_list'
template_name
=
'users/user_list.html'
ordering
=
'-date_joined'
...
...
@@ -20,9 +20,13 @@ class UserListView(ListView):
def
get_queryset
(
self
):
self
.
queryset
=
super
(
UserListView
,
self
)
.
get_queryset
()
self
.
keyword
=
keyword
=
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
self
.
sort
=
sort
=
self
.
request
.
GET
.
get
(
'sort'
)
if
keyword
:
self
.
queryset
=
self
.
queryset
.
filter
(
Q
(
username__icontains
=
keyword
)
|
Q
(
name__icontains
=
keyword
))
if
sort
:
self
.
queryset
=
self
.
queryset
.
order_by
(
sort
)
return
self
.
queryset
def
get_context_data
(
self
,
**
kwargs
):
...
...
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