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
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
11 deletions
+87
-11
datatables.min.css
apps/static/css/plugins/dataTables/datatables.min.css
+21
-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 combined file was created by the DataTables downloader builder:
* https://datatables.net/download
*
* To rebuild or modify this file with the latest versions of the included
* software please visit:
* https://datatables.net/download/#bs/pdfmake-0.1.18,dt-1.10.10,b-1.1.0,b-html5-1.1.0,b-print-1.1.0,r-2.0.0
*
* Included libraries:
* pdfmake 0.1.18, DataTables 1.10.10, Buttons 1.1.0, HTML5 export 1.1.0, Print view 1.1.0, Responsive 2.0.0
*/
table
.dataTable
{
clear
:
both
;
margin-top
:
6px
!important
;
margin-bottom
:
6px
!important
;
max-width
:
none
!important
}
table
.dataTable
td
,
table
.dataTable
th
{
-webkit-box-sizing
:
content-box
;
-moz-box-sizing
:
content-box
;
box-sizing
:
content-box
}
table
.dataTable
td
.dataTables_empty
,
table
.dataTable
th
.dataTables_empty
{
text-align
:
center
}
table
.dataTable.nowrap
th
,
table
.dataTable.nowrap
td
{
white-space
:
nowrap
}
div
.dataTables_wrapper
div
.dataTables_length
label
{
font-weight
:
normal
;
text-align
:
left
;
white-space
:
nowrap
}
div
.dataTables_wrapper
div
.dataTables_length
select
{
width
:
75px
;
display
:
inline-block
}
div
.dataTables_wrapper
div
.dataTables_filter
{
text-align
:
right
}
div
.dataTables_wrapper
div
.dataTables_filter
label
{
font-weight
:
normal
;
white-space
:
nowrap
;
text-align
:
left
}
div
.dataTables_wrapper
div
.dataTables_filter
input
{
margin-left
:
0.5em
;
display
:
inline-block
;
width
:
auto
}
div
.dataTables_wrapper
div
.dataTables_info
{
padding-top
:
8px
;
white-space
:
nowrap
}
div
.dataTables_wrapper
div
.dataTables_paginate
{
margin
:
0
;
white-space
:
nowrap
;
text-align
:
right
}
div
.dataTables_wrapper
div
.dataTables_paginate
ul
.pagination
{
margin
:
2px
0
;
white-space
:
nowrap
}
div
.dataTables_wrapper
div
.dataTables_processing
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
width
:
200px
;
margin-left
:
-100px
;
margin-top
:
-26px
;
text-align
:
center
;
padding
:
1em
0
}
table
.dataTable
thead
>
tr
>
th
.sorting_asc
,
table
.dataTable
thead
>
tr
>
th
.sorting_desc
,
table
.dataTable
thead
>
tr
>
th
.sorting
,
table
.dataTable
thead
>
tr
>
td
.sorting_asc
,
table
.dataTable
thead
>
tr
>
td
.sorting_desc
,
table
.dataTable
thead
>
tr
>
td
.sorting
{
padding-right
:
30px
}
table
.dataTable
thead
>
tr
>
th
:active
,
table
.dataTable
thead
>
tr
>
td
:active
{
outline
:
none
}
table
.dataTable
thead
.sorting
,
table
.dataTable
thead
.sorting_asc
,
table
.dataTable
thead
.sorting_desc
,
table
.dataTable
thead
.sorting_asc_disabled
,
table
.dataTable
thead
.sorting_desc_disabled
{
cursor
:
pointer
;
position
:
relative
}
table
.dataTable
thead
.sorting
:after
,
table
.dataTable
thead
.sorting_asc
:after
,
table
.dataTable
thead
.sorting_desc
:after
,
table
.dataTable
thead
.sorting_asc_disabled
:after
,
table
.dataTable
thead
.sorting_desc_disabled
:after
{
position
:
absolute
;
bottom
:
8px
;
right
:
8px
;
display
:
block
;
font-family
:
'Glyphicons Halflings'
;
opacity
:
0.5
}
table
.dataTable
thead
.sorting
:after
{
opacity
:
0.2
;
content
:
"\e150"
}
table
.dataTable
thead
.sorting_asc
:after
{
content
:
"\e155"
}
table
.dataTable
thead
.sorting_desc
:after
{
content
:
"\e156"
}
table
.dataTable
thead
.sorting_asc_disabled
:after
,
table
.dataTable
thead
.sorting_desc_disabled
:after
{
color
:
#eee
}
div
.dataTables_scrollHead
table
.dataTable
{
margin-bottom
:
0
!important
}
div
.dataTables_scrollBody
table
{
border-top
:
none
;
margin-top
:
0
!important
;
margin-bottom
:
0
!important
}
div
.dataTables_scrollBody
table
thead
.sorting
:after
,
div
.dataTables_scrollBody
table
thead
.sorting_asc
:after
,
div
.dataTables_scrollBody
table
thead
.sorting_desc
:after
{
display
:
none
}
div
.dataTables_scrollBody
table
tbody
tr
:first-child
th
,
div
.dataTables_scrollBody
table
tbody
tr
:first-child
td
{
border-top
:
none
}
div
.dataTables_scrollFoot
table
{
margin-top
:
0
!important
;
border-top
:
none
}
@media
screen
and
(
max-width
:
767px
){
div
.dataTables_wrapper
div
.dataTables_length
,
div
.dataTables_wrapper
div
.dataTables_filter
,
div
.dataTables_wrapper
div
.dataTables_info
,
div
.dataTables_wrapper
div
.dataTables_paginate
{
text-align
:
center
}}
table
.dataTable.table-condensed
>
thead
>
tr
>
th
{
padding-right
:
20px
}
table
.dataTable.table-condensed
.sorting
:after
,
table
.dataTable.table-condensed
.sorting_asc
:after
,
table
.dataTable.table-condensed
.sorting_desc
:after
{
top
:
6px
;
right
:
6px
}
table
.table-bordered.dataTable
{
border-collapse
:
separate
!important
}
table
.table-bordered.dataTable
th
,
table
.table-bordered.dataTable
td
{
border-left-width
:
0
}
table
.table-bordered.dataTable
th
:last-child
,
table
.table-bordered.dataTable
th
:last-child
,
table
.table-bordered.dataTable
td
:last-child
,
table
.table-bordered.dataTable
td
:last-child
{
border-right-width
:
0
}
table
.table-bordered.dataTable
tbody
th
,
table
.table-bordered.dataTable
tbody
td
{
border-bottom-width
:
0
}
div
.dataTables_scrollHead
table
.table-bordered
{
border-bottom-width
:
0
}
div
.table-responsive
>
div
.dataTables_wrapper
>
div
.row
{
margin
:
0
}
div
.table-responsive
>
div
.dataTables_wrapper
>
div
.row
>
div
[
class
^=
"col-"
]
:first-child
{
padding-left
:
0
}
div
.table-responsive
>
div
.dataTables_wrapper
>
div
.row
>
div
[
class
^=
"col-"
]
:last-child
{
padding-right
:
0
}
div
.dt-button-info
{
position
:
fixed
;
top
:
50%
;
left
:
50%
;
width
:
400px
;
margin-top
:
-100px
;
margin-left
:
-200px
;
background-color
:
white
;
border
:
2px
solid
#111
;
box-shadow
:
3px
3px
8px
rgba
(
0
,
0
,
0
,
0.3
);
border-radius
:
3px
;
text-align
:
center
;
z-index
:
21
}
div
.dt-button-info
h2
{
padding
:
0.5em
;
margin
:
0
;
font-weight
:
normal
;
border-bottom
:
1px
solid
#ddd
;
background-color
:
#f3f3f3
}
div
.dt-button-info
>
div
{
padding
:
1em
}
ul
.dt-button-collection.dropdown-menu
{
display
:
block
;
z-index
:
2002
;
-webkit-column-gap
:
8px
;
-moz-column-gap
:
8px
;
-ms-column-gap
:
8px
;
-o-column-gap
:
8px
;
column-gap
:
8px
}
ul
.dt-button-collection.dropdown-menu.fixed
{
position
:
fixed
;
top
:
50%
;
left
:
50%
;
margin-left
:
-75px
;
border-radius
:
0
}
ul
.dt-button-collection.dropdown-menu.fixed.two-column
{
margin-left
:
-150px
}
ul
.dt-button-collection.dropdown-menu.fixed.three-column
{
margin-left
:
-225px
}
ul
.dt-button-collection.dropdown-menu.fixed.four-column
{
margin-left
:
-300px
}
ul
.dt-button-collection.dropdown-menu
>*
{
-webkit-column-break-inside
:
avoid
;
break-inside
:
avoid
}
ul
.dt-button-collection.dropdown-menu.two-column
{
width
:
300px
;
padding-bottom
:
1px
;
-webkit-column-count
:
2
;
-moz-column-count
:
2
;
-ms-column-count
:
2
;
-o-column-count
:
2
;
column-count
:
2
}
ul
.dt-button-collection.dropdown-menu.three-column
{
width
:
450px
;
padding-bottom
:
1px
;
-webkit-column-count
:
3
;
-moz-column-count
:
3
;
-ms-column-count
:
3
;
-o-column-count
:
3
;
column-count
:
3
}
ul
.dt-button-collection.dropdown-menu.four-column
{
width
:
600px
;
padding-bottom
:
1px
;
-webkit-column-count
:
4
;
-moz-column-count
:
4
;
-ms-column-count
:
4
;
-o-column-count
:
4
;
column-count
:
4
}
div
.dt-button-background
{
position
:
fixed
;
top
:
0
;
left
:
0
;
width
:
100%
;
height
:
100%
;
z-index
:
2001
}
@media
screen
and
(
max-width
:
767px
){
div
.dt-buttons
{
float
:
none
;
width
:
100%
;
text-align
:
center
;
margin-bottom
:
0.5em
}
div
.dt-buttons
a
.btn
{
float
:
none
}}
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
td
.child
,
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
th
.child
,
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
td
.dataTables_empty
{
cursor
:
default
!important
}
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
td
.child
:before
,
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
th
.child
:before
,
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
td
.dataTables_empty
:before
{
display
:
none
!important
}
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
td
:first-child
,
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
th
:first-child
{
position
:
relative
;
padding-left
:
30px
;
cursor
:
pointer
}
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
td
:first-child:before
,
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
>
th
:first-child:before
{
top
:
8px
;
left
:
4px
;
height
:
16px
;
width
:
16px
;
display
:
block
;
position
:
absolute
;
color
:
white
;
border
:
2px
solid
white
;
border-radius
:
16px
;
box-shadow
:
0
0
3px
#444
;
box-sizing
:
content-box
;
font-family
:
'Courier New'
,
Courier
,
monospace
;
text-indent
:
4px
;
line-height
:
16px
;
content
:
'+'
;
background-color
:
#337ab7
}
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
.parent
>
td
:first-child:before
,
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
.parent
>
th
:first-child:before
{
content
:
'-'
;
background-color
:
#d33333
}
table
.dataTable.dtr-inline.collapsed
>
tbody
>
tr
.child
td
:before
{
display
:
none
}
table
.dataTable.dtr-inline.collapsed.compact
>
tbody
>
tr
>
td
:first-child
,
table
.dataTable.dtr-inline.collapsed.compact
>
tbody
>
tr
>
th
:first-child
{
padding-left
:
27px
}
table
.dataTable.dtr-inline.collapsed.compact
>
tbody
>
tr
>
td
:first-child:before
,
table
.dataTable.dtr-inline.collapsed.compact
>
tbody
>
tr
>
th
:first-child:before
{
top
:
5px
;
left
:
4px
;
height
:
14px
;
width
:
14px
;
border-radius
:
14px
;
line-height
:
14px
;
text-indent
:
3px
}
table
.dataTable.dtr-column
>
tbody
>
tr
>
td
.control
,
table
.dataTable.dtr-column
>
tbody
>
tr
>
th
.control
{
position
:
relative
;
cursor
:
pointer
}
table
.dataTable.dtr-column
>
tbody
>
tr
>
td
.control
:before
,
table
.dataTable.dtr-column
>
tbody
>
tr
>
th
.control
:before
{
top
:
50%
;
left
:
50%
;
height
:
16px
;
width
:
16px
;
margin-top
:
-10px
;
margin-left
:
-10px
;
display
:
block
;
position
:
absolute
;
color
:
white
;
border
:
2px
solid
white
;
border-radius
:
16px
;
box-shadow
:
0
0
3px
#444
;
box-sizing
:
content-box
;
font-family
:
'Courier New'
,
Courier
,
monospace
;
text-indent
:
4px
;
line-height
:
16px
;
content
:
'+'
;
background-color
:
#337ab7
}
table
.dataTable.dtr-column
>
tbody
>
tr
.parent
td
.control
:before
,
table
.dataTable.dtr-column
>
tbody
>
tr
.parent
th
.control
:before
{
content
:
'-'
;
background-color
:
#d33333
}
table
.dataTable
>
tbody
>
tr
.child
{
padding
:
0.5em
1em
}
table
.dataTable
>
tbody
>
tr
.child
:hover
{
background
:
transparent
!important
}
table
.dataTable
>
tbody
>
tr
.child
ul
{
display
:
inline-block
;
list-style-type
:
none
;
margin
:
0
;
padding
:
0
}
table
.dataTable
>
tbody
>
tr
.child
ul
li
{
border-bottom
:
1px
solid
#efefef
;
padding
:
0.5em
0
}
table
.dataTable
>
tbody
>
tr
.child
ul
li
:first-child
{
padding-top
:
0
}
table
.dataTable
>
tbody
>
tr
.child
ul
li
:last-child
{
border-bottom
:
none
}
table
.dataTable
>
tbody
>
tr
.child
span
.dtr-title
{
display
:
inline-block
;
min-width
:
75px
;
font-weight
:
bold
}
div
.dtr-modal
{
position
:
fixed
;
box-sizing
:
border-box
;
top
:
0
;
left
:
0
;
height
:
100%
;
width
:
100%
;
z-index
:
100
;
padding
:
10em
1em
}
div
.dtr-modal
div
.dtr-modal-display
{
position
:
absolute
;
top
:
0
;
left
:
0
;
bottom
:
0
;
right
:
0
;
width
:
50%
;
height
:
50%
;
overflow
:
auto
;
margin
:
auto
;
z-index
:
102
;
overflow
:
auto
;
background-color
:
#f5f5f7
;
border
:
1px
solid
black
;
border-radius
:
0.5em
;
box-shadow
:
0
12px
30px
rgba
(
0
,
0
,
0
,
0.6
)}
div
.dtr-modal
div
.dtr-modal-content
{
position
:
relative
;
padding
:
1em
}
div
.dtr-modal
div
.dtr-modal-close
{
position
:
absolute
;
top
:
6px
;
right
:
6px
;
width
:
22px
;
height
:
22px
;
border
:
1px
solid
#eaeaea
;
background-color
:
#f9f9f9
;
text-align
:
center
;
border-radius
:
3px
;
cursor
:
pointer
;
z-index
:
12
}
div
.dtr-modal
div
.dtr-modal-close
:hover
{
background-color
:
#eaeaea
}
div
.dtr-modal
div
.dtr-modal-background
{
position
:
fixed
;
top
:
0
;
left
:
0
;
right
:
0
;
bottom
:
0
;
z-index
:
101
;
background
:
rgba
(
0
,
0
,
0
,
0.6
)}
@media
screen
and
(
max-width
:
767px
){
div
.dtr-modal
div
.dtr-modal-display
{
width
:
95%
}}
apps/static/css/style.css
View file @
651e8999
...
@@ -4600,3 +4600,4 @@ body.skin-3 {
...
@@ -4600,3 +4600,4 @@ body.skin-3 {
border-width
:
1px
border-width
:
1px
}
}
apps/static/js/plugins/dataTables/datatables.min.js
0 → 100755
View file @
651e8999
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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 @@
...
@@ -111,8 +111,8 @@
<td><b>
{{ user.last_login|date:"Y-m-j H:i:s" }}
</b></td>
<td><b>
{{ user.last_login|date:"Y-m-j H:i:s" }}
</b></td>
</tr>
</tr>
<tr>
<tr>
<td>
描述:
</td>
<td
class=
"no-borders"
>
描述:
</td>
<td><b>
{{ user.comment }}
</b></td>
<td
class=
"no-borders"
><b>
{{ user.comment }}
</b></td>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
...
@@ -208,8 +208,10 @@
...
@@ -208,8 +208,10 @@
{% for group in user.groups.all %}
{% for group in user.groups.all %}
<tr>
<tr>
<td
width=
"40%"
><b>
{{ group.name }}
</b></td>
<td
width=
"40%"
><b
style=
"font-size: medium"
>
{{ group.name }}
</b></td>
<td></td>
<td>
<button
class=
"btn btn-danger btn-sm"
type=
"button"
style=
"float: right;"
><i
class=
"fa fa-minus"
></i></button>
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</tbody>
...
...
apps/users/templates/users/user_list.html
View file @
651e8999
...
@@ -42,12 +42,12 @@
...
@@ -42,12 +42,12 @@
<th
class=
"text-center"
>
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
</th>
<th
class=
"text-center"
>
姓名
</th>
<th
class=
"text-center"
>
<a
href=
"{% url 'users:user-list' %}?sort=name"
>
姓名
</a>
</th>
<th
class=
"text-center"
>
用户名
</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"
>
资产数量
</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>
<th
class=
"text-center"
></th>
</tr>
</tr>
</thead>
</thead>
...
@@ -66,7 +66,13 @@
...
@@ -66,7 +66,13 @@
<td
class=
"text-center"
>
{{ user.role.name }}
</td>
<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>
<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>
<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"
>
<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-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>
<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
...
@@ -12,7 +12,7 @@ from .forms import UserAddForm, UserUpdateForm
class
UserListView
(
ListView
):
class
UserListView
(
ListView
):
model
=
User
model
=
User
paginate_by
=
1
0
paginate_by
=
2
0
context_object_name
=
'user_list'
context_object_name
=
'user_list'
template_name
=
'users/user_list.html'
template_name
=
'users/user_list.html'
ordering
=
'-date_joined'
ordering
=
'-date_joined'
...
@@ -20,9 +20,13 @@ class UserListView(ListView):
...
@@ -20,9 +20,13 @@ class UserListView(ListView):
def
get_queryset
(
self
):
def
get_queryset
(
self
):
self
.
queryset
=
super
(
UserListView
,
self
)
.
get_queryset
()
self
.
queryset
=
super
(
UserListView
,
self
)
.
get_queryset
()
self
.
keyword
=
keyword
=
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
self
.
keyword
=
keyword
=
self
.
request
.
GET
.
get
(
'keyword'
,
''
)
self
.
sort
=
sort
=
self
.
request
.
GET
.
get
(
'sort'
)
if
keyword
:
if
keyword
:
self
.
queryset
=
self
.
queryset
.
filter
(
Q
(
username__icontains
=
keyword
)
|
self
.
queryset
=
self
.
queryset
.
filter
(
Q
(
username__icontains
=
keyword
)
|
Q
(
name__icontains
=
keyword
))
Q
(
name__icontains
=
keyword
))
if
sort
:
self
.
queryset
=
self
.
queryset
.
order_by
(
sort
)
return
self
.
queryset
return
self
.
queryset
def
get_context_data
(
self
,
**
kwargs
):
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