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
15dcc760
Commit
15dcc760
authored
Sep 26, 2016
by
xiaoyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user list bulk update modal
parent
d2197d99
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
80 additions
and
47 deletions
+80
-47
select2.min.css
apps/static/css/plugins/select2/select2.min.css
+1
-2
jumpserver.js
apps/static/js/jumpserver.js
+19
-3
select2.full.min.js
apps/static/js/plugins/select2/select2.full.min.js
+0
-0
_base_list.html
apps/templates/_base_list.html
+2
-0
_modal.html
apps/templates/_modal.html
+1
-1
_user_bulk_update_modal.html
apps/users/templates/users/_user_bulk_update_modal.html
+37
-0
user_list.html
apps/users/templates/users/user_list.html
+17
-1
urls.py
apps/users/urls.py
+0
-1
views.py
apps/users/views.py
+3
-39
No files found.
apps/static/css/plugins/select2/select2.min.css
View file @
15dcc760
.select2-container
{
box-sizing
:
border-box
;
display
:
inline-block
;
margin
:
0
;
position
:
relative
;
vertical-align
:
middle
;}
.select2-container
.select2-selection--single
{
box-sizing
:
border-box
;
cursor
:
pointer
;
display
:
block
;
height
:
28px
;
user-select
:
none
;
-webkit-user-select
:
none
;}
.select2-container
.select2-selection--single
.select2-selection__rendered
{
display
:
block
;
padding-left
:
8px
;
padding-right
:
20px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;}
.select2-container
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__rendered
{
padding-right
:
8px
;
padding-left
:
20px
;}
.select2-container
.select2-selection--multiple
{
box-sizing
:
border-box
;
cursor
:
pointer
;
display
:
block
;
min-height
:
32px
;
user-select
:
none
;
-webkit-user-select
:
none
;}
.select2-container
.select2-selection--multiple
.select2-selection__rendered
{
display
:
inline-block
;
overflow
:
hidden
;
padding-left
:
8px
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;}
.select2-container
.select2-search--inline
{
float
:
left
;}
.select2-container
.select2-search--inline
.select2-search__field
{
box-sizing
:
border-box
;
border
:
none
;
font-size
:
100%
;
margin-top
:
5px
;}
.select2-container
.select2-search--inline
.select2-search__field
::-webkit-search-cancel-button
{
-webkit-appearance
:
none
;}
.select2-dropdown
{
background-color
:
white
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
box-sizing
:
border-box
;
display
:
block
;
position
:
absolute
;
left
:
-100000px
;
width
:
100%
;
z-index
:
1051
;}
.select2-results
{
display
:
block
;}
.select2-results__options
{
list-style
:
none
;
margin
:
0
;
padding
:
0
;}
.select2-results__option
{
padding
:
6px
;
user-select
:
none
;
-webkit-user-select
:
none
;}
.select2-results__option
[
aria-selected
]
{
cursor
:
pointer
;}
.select2-container--open
.select2-dropdown
{
left
:
0
;}
.select2-container--open
.select2-dropdown--above
{
border-bottom
:
none
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
;}
.select2-container--open
.select2-dropdown--below
{
border-top
:
none
;
border-top-left-radius
:
0
;
border-top-right-radius
:
0
;}
.select2-search--dropdown
{
display
:
block
;
padding
:
4px
;}
.select2-search--dropdown
.select2-search__field
{
padding
:
4px
;
width
:
100%
;
box-sizing
:
border-box
;}
.select2-search--dropdown
.select2-search__field
::-webkit-search-cancel-button
{
-webkit-appearance
:
none
;}
.select2-search--dropdown.select2-search--hide
{
display
:
none
;}
.select2-close-mask
{
border
:
0
;
margin
:
0
;
padding
:
0
;
display
:
block
;
position
:
fixed
;
left
:
0
;
top
:
0
;
min-height
:
100%
;
min-width
:
100%
;
height
:
auto
;
width
:
auto
;
opacity
:
0
;
z-index
:
99
;
background-color
:
#fff
;
filter
:
alpha
(
opacity
=
0
);}
.select2-hidden-accessible
{
border
:
0
;
clip
:
rect
(
0
0
0
0
);
height
:
1px
;
margin
:
-1px
;
overflow
:
hidden
;
padding
:
0
;
position
:
absolute
;
width
:
1px
;}
.select2-container--default
.select2-selection--single
{
background-color
:
#fff
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;}
.select2-container--default
.select2-selection--single
.select2-selection__rendered
{
color
:
#444
;
line-height
:
28px
;}
.select2-container--default
.select2-selection--single
.select2-selection__clear
{
cursor
:
pointer
;
float
:
right
;
font-weight
:
bold
;}
.select2-container--default
.select2-selection--single
.select2-selection__placeholder
{
color
:
#999
;}
.select2-container--default
.select2-selection--single
.select2-selection__arrow
{
height
:
26px
;
position
:
absolute
;
top
:
1px
;
right
:
1px
;
width
:
20px
;}
.select2-container--default
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
#888
transparent
transparent
transparent
;
border-style
:
solid
;
border-width
:
5px
4px
0
4px
;
height
:
0
;
left
:
50%
;
margin-left
:
-4px
;
margin-top
:
-2px
;
position
:
absolute
;
top
:
50%
;
width
:
0
;}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__clear
{
float
:
left
;}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__arrow
{
left
:
1px
;
right
:
auto
;}
.select2-container--default.select2-container--disabled
.select2-selection--single
{
background-color
:
#eee
;
cursor
:
default
;}
.select2-container--default.select2-container--disabled
.select2-selection--single
.select2-selection__clear
{
display
:
none
;}
.select2-container--default.select2-container--open
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
transparent
transparent
#888
transparent
;
border-width
:
0
4px
5px
4px
;}
.select2-container--default
.select2-selection--multiple
{
background-color
:
white
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
text
;}
.select2-container--default
.select2-selection--multiple
.select2-selection__rendered
{
box-sizing
:
border-box
;
list-style
:
none
;
margin
:
0
;
padding
:
0
5px
;
width
:
100%
;}
.select2-container--default
.select2-selection--multiple
.select2-selection__placeholder
{
color
:
#999
;
margin-top
:
5px
;
float
:
left
;}
.select2-container--default
.select2-selection--multiple
.select2-selection__clear
{
cursor
:
pointer
;
float
:
right
;
font-weight
:
bold
;
margin-top
:
5px
;
margin-right
:
10px
;}
.select2-container--default
.select2-selection--multiple
.select2-selection__choice
{
background-color
:
#e4e4e4
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
default
;
float
:
left
;
margin-right
:
5px
;
margin-top
:
5px
;
padding
:
0
5px
;}
.select2-container--default
.select2-selection--multiple
.select2-selection__choice__remove
{
color
:
#999
;
cursor
:
pointer
;
display
:
inline-block
;
font-weight
:
bold
;
margin-right
:
2px
;}
.select2-container--default
.select2-selection--multiple
.select2-selection__choice__remove
:hover
{
color
:
#333
;}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
,
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__placeholder
{
float
:
right
;}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
{
margin-left
:
5px
;
margin-right
:
auto
;}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice__remove
{
margin-left
:
2px
;
margin-right
:
auto
;}
.select2-container--default.select2-container--focus
.select2-selection--multiple
{
border
:
solid
black
1px
;
outline
:
0
;}
.select2-container--default.select2-container--disabled
.select2-selection--multiple
{
background-color
:
#eee
;
cursor
:
default
;}
.select2-container--default.select2-container--disabled
.select2-selection__choice__remove
{
display
:
none
;}
.select2-container--default.select2-container--open.select2-container--above
.select2-selection--single
,
.select2-container--default.select2-container--open.select2-container--above
.select2-selection--multiple
{
border-top-left-radius
:
0
;
border-top-right-radius
:
0
;}
.select2-container--default.select2-container--open.select2-container--below
.select2-selection--single
,
.select2-container--default.select2-container--open.select2-container--below
.select2-selection--multiple
{
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
;}
.select2-container--default
.select2-search--dropdown
.select2-search__field
{
border
:
1px
solid
#aaa
;}
.select2-container--default
.select2-search--inline
.select2-search__field
{
background
:
transparent
;
border
:
none
;
outline
:
0
;}
.select2-container--default
.select2-results
>
.select2-results__options
{
max-height
:
200px
;
overflow-y
:
auto
;}
.select2-container--default
.select2-results__option
[
role
=
group
]
{
padding
:
0
;}
.select2-container--default
.select2-results__option
[
aria-disabled
=
true
]
{
color
:
#999
;}
.select2-container--default
.select2-results__option
[
aria-selected
=
true
]
{
background-color
:
#ddd
;}
.select2-container--default
.select2-results__option
.select2-results__option
{
padding-left
:
1em
;}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__group
{
padding-left
:
0
;}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-1em
;
padding-left
:
2em
;}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-2em
;
padding-left
:
3em
;}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-3em
;
padding-left
:
4em
;}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-4em
;
padding-left
:
5em
;}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-5em
;
padding-left
:
6em
;}
.select2-container--default
.select2-results__option--highlighted
[
aria-selected
]
{
background-color
:
#5897fb
;
color
:
white
;}
.select2-container--default
.select2-results__group
{
cursor
:
default
;
display
:
block
;
padding
:
6px
;}
.select2-container--classic
.select2-selection--single
{
background-color
:
#f6f6f6
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
outline
:
0
;
background-image
:
-webkit-linear-gradient
(
top
,
#ffffff
50%
,
#eeeeee
100%
);
background-image
:
-o-linear-gradient
(
top
,
#ffffff
50%
,
#eeeeee
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#ffffff
50%
,
#eeeeee
100%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#ffffff'
,
endColorstr
=
'#eeeeee'
,
GradientType
=
0
);}
.select2-container--classic
.select2-selection--single
:focus
{
border
:
1px
solid
#5897fb
;}
.select2-container--classic
.select2-selection--single
.select2-selection__rendered
{
color
:
#444
;
line-height
:
28px
;}
.select2-container--classic
.select2-selection--single
.select2-selection__clear
{
cursor
:
pointer
;
float
:
right
;
font-weight
:
bold
;
margin-right
:
10px
;}
.select2-container--classic
.select2-selection--single
.select2-selection__placeholder
{
color
:
#999
;}
.select2-container--classic
.select2-selection--single
.select2-selection__arrow
{
background-color
:
#ddd
;
border
:
none
;
border-left
:
1px
solid
#aaa
;
border-top-right-radius
:
4px
;
border-bottom-right-radius
:
4px
;
height
:
26px
;
position
:
absolute
;
top
:
1px
;
right
:
1px
;
width
:
20px
;
background-image
:
-webkit-linear-gradient
(
top
,
#eeeeee
50%
,
#cccccc
100%
);
background-image
:
-o-linear-gradient
(
top
,
#eeeeee
50%
,
#cccccc
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#eeeeee
50%
,
#cccccc
100%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#eeeeee'
,
endColorstr
=
'#cccccc'
,
GradientType
=
0
);}
.select2-container--classic
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
#888
transparent
transparent
transparent
;
border-style
:
solid
;
border-width
:
5px
4px
0
4px
;
height
:
0
;
left
:
50%
;
margin-left
:
-4px
;
margin-top
:
-2px
;
position
:
absolute
;
top
:
50%
;
width
:
0
;}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__clear
{
float
:
left
;}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__arrow
{
border
:
none
;
border-right
:
1px
solid
#aaa
;
border-radius
:
0
;
border-top-left-radius
:
4px
;
border-bottom-left-radius
:
4px
;
left
:
1px
;
right
:
auto
;}
.select2-container--classic.select2-container--open
.select2-selection--single
{
border
:
1px
solid
#5897fb
;}
.select2-container--classic.select2-container--open
.select2-selection--single
.select2-selection__arrow
{
background
:
transparent
;
border
:
none
;}
.select2-container--classic.select2-container--open
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
transparent
transparent
#888
transparent
;
border-width
:
0
4px
5px
4px
;}
.select2-container--classic.select2-container--open.select2-container--above
.select2-selection--single
{
border-top
:
none
;
border-top-left-radius
:
0
;
border-top-right-radius
:
0
;
background-image
:
-webkit-linear-gradient
(
top
,
#ffffff
0%
,
#eeeeee
50%
);
background-image
:
-o-linear-gradient
(
top
,
#ffffff
0%
,
#eeeeee
50%
);
background-image
:
linear-gradient
(
to
bottom
,
#ffffff
0%
,
#eeeeee
50%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#ffffff'
,
endColorstr
=
'#eeeeee'
,
GradientType
=
0
);}
.select2-container--classic.select2-container--open.select2-container--below
.select2-selection--single
{
border-bottom
:
none
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
;
background-image
:
-webkit-linear-gradient
(
top
,
#eeeeee
50%
,
#ffffff
100%
);
background-image
:
-o-linear-gradient
(
top
,
#eeeeee
50%
,
#ffffff
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#eeeeee
50%
,
#ffffff
100%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#eeeeee'
,
endColorstr
=
'#ffffff'
,
GradientType
=
0
);}
.select2-container--classic
.select2-selection--multiple
{
background-color
:
white
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
text
;
outline
:
0
;}
.select2-container--classic
.select2-selection--multiple
:focus
{
border
:
1px
solid
#5897fb
;}
.select2-container--classic
.select2-selection--multiple
.select2-selection__rendered
{
list-style
:
none
;
margin
:
0
;
padding
:
0
5px
;}
.select2-container--classic
.select2-selection--multiple
.select2-selection__clear
{
display
:
none
;}
.select2-container--classic
.select2-selection--multiple
.select2-selection__choice
{
background-color
:
#e4e4e4
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
default
;
float
:
left
;
margin-right
:
5px
;
margin-top
:
5px
;
padding
:
0
5px
;}
.select2-container--classic
.select2-selection--multiple
.select2-selection__choice__remove
{
color
:
#888
;
cursor
:
pointer
;
display
:
inline-block
;
font-weight
:
bold
;
margin-right
:
2px
;}
.select2-container--classic
.select2-selection--multiple
.select2-selection__choice__remove
:hover
{
color
:
#555
;}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
{
float
:
right
;}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
{
margin-left
:
5px
;
margin-right
:
auto
;}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice__remove
{
margin-left
:
2px
;
margin-right
:
auto
;}
.select2-container--classic.select2-container--open
.select2-selection--multiple
{
border
:
1px
solid
#5897fb
;}
.select2-container--classic.select2-container--open.select2-container--above
.select2-selection--multiple
{
border-top
:
none
;
border-top-left-radius
:
0
;
border-top-right-radius
:
0
;}
.select2-container--classic.select2-container--open.select2-container--below
.select2-selection--multiple
{
border-bottom
:
none
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
;}
.select2-container--classic
.select2-search--dropdown
.select2-search__field
{
border
:
1px
solid
#aaa
;
outline
:
0
;}
.select2-container--classic
.select2-search--inline
.select2-search__field
{
outline
:
0
;}
.select2-container--classic
.select2-dropdown
{
background-color
:
white
;
border
:
1px
solid
transparent
;}
.select2-container--classic
.select2-dropdown--above
{
border-bottom
:
none
;}
.select2-container--classic
.select2-dropdown--below
{
border-top
:
none
;}
.select2-container--classic
.select2-results
>
.select2-results__options
{
max-height
:
200px
;
overflow-y
:
auto
;}
.select2-container--classic
.select2-results__option
[
role
=
group
]
{
padding
:
0
;}
.select2-container--classic
.select2-results__option
[
aria-disabled
=
true
]
{
color
:
grey
;}
.select2-container--classic
.select2-results__option--highlighted
[
aria-selected
]
{
background-color
:
#3875d7
;
color
:
white
;}
.select2-container--classic
.select2-results__group
{
cursor
:
default
;
display
:
block
;
padding
:
6px
;}
.select2-container--classic.select2-container--open
.select2-dropdown
{
border-color
:
#5897fb
;}
.select2-container
{
box-sizing
:
border-box
;
display
:
inline-block
;
margin
:
0
;
position
:
relative
;
vertical-align
:
middle
}
.select2-container
.select2-selection--single
{
box-sizing
:
border-box
;
cursor
:
pointer
;
display
:
block
;
height
:
28px
;
user-select
:
none
;
-webkit-user-select
:
none
}
.select2-container
.select2-selection--single
.select2-selection__rendered
{
display
:
block
;
padding-left
:
8px
;
padding-right
:
20px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
}
.select2-container
.select2-selection--single
.select2-selection__clear
{
position
:
relative
}
.select2-container
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__rendered
{
padding-right
:
8px
;
padding-left
:
20px
}
.select2-container
.select2-selection--multiple
{
box-sizing
:
border-box
;
cursor
:
pointer
;
display
:
block
;
min-height
:
32px
;
user-select
:
none
;
-webkit-user-select
:
none
}
.select2-container
.select2-selection--multiple
.select2-selection__rendered
{
display
:
inline-block
;
overflow
:
hidden
;
padding-left
:
8px
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
}
.select2-container
.select2-search--inline
{
float
:
left
}
.select2-container
.select2-search--inline
.select2-search__field
{
box-sizing
:
border-box
;
border
:
none
;
font-size
:
100%
;
margin-top
:
5px
;
padding
:
0
}
.select2-container
.select2-search--inline
.select2-search__field
::-webkit-search-cancel-button
{
-webkit-appearance
:
none
}
.select2-dropdown
{
background-color
:
white
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
box-sizing
:
border-box
;
display
:
block
;
position
:
absolute
;
left
:
-100000px
;
width
:
100%
;
z-index
:
1051
}
.select2-results
{
display
:
block
}
.select2-results__options
{
list-style
:
none
;
margin
:
0
;
padding
:
0
}
.select2-results__option
{
padding
:
6px
;
user-select
:
none
;
-webkit-user-select
:
none
}
.select2-results__option
[
aria-selected
]
{
cursor
:
pointer
}
.select2-container--open
.select2-dropdown
{
left
:
0
}
.select2-container--open
.select2-dropdown--above
{
border-bottom
:
none
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
}
.select2-container--open
.select2-dropdown--below
{
border-top
:
none
;
border-top-left-radius
:
0
;
border-top-right-radius
:
0
}
.select2-search--dropdown
{
display
:
block
;
padding
:
4px
}
.select2-search--dropdown
.select2-search__field
{
padding
:
4px
;
width
:
100%
;
box-sizing
:
border-box
}
.select2-search--dropdown
.select2-search__field
::-webkit-search-cancel-button
{
-webkit-appearance
:
none
}
.select2-search--dropdown.select2-search--hide
{
display
:
none
}
.select2-close-mask
{
border
:
0
;
margin
:
0
;
padding
:
0
;
display
:
block
;
position
:
fixed
;
left
:
0
;
top
:
0
;
min-height
:
100%
;
min-width
:
100%
;
height
:
auto
;
width
:
auto
;
opacity
:
0
;
z-index
:
99
;
background-color
:
#fff
;
filter
:
alpha
(
opacity
=
0
)}
.select2-hidden-accessible
{
border
:
0
!important
;
clip
:
rect
(
0
0
0
0
)
!important
;
height
:
1px
!important
;
margin
:
-1px
!important
;
overflow
:
hidden
!important
;
padding
:
0
!important
;
position
:
absolute
!important
;
width
:
1px
!important
}
.select2-container--default
.select2-selection--single
{
background-color
:
#fff
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
}
.select2-container--default
.select2-selection--single
.select2-selection__rendered
{
color
:
#444
;
line-height
:
28px
}
.select2-container--default
.select2-selection--single
.select2-selection__clear
{
cursor
:
pointer
;
float
:
right
;
font-weight
:
bold
}
.select2-container--default
.select2-selection--single
.select2-selection__placeholder
{
color
:
#999
}
.select2-container--default
.select2-selection--single
.select2-selection__arrow
{
height
:
26px
;
position
:
absolute
;
top
:
1px
;
right
:
1px
;
width
:
20px
}
.select2-container--default
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
#888
transparent
transparent
transparent
;
border-style
:
solid
;
border-width
:
5px
4px
0
4px
;
height
:
0
;
left
:
50%
;
margin-left
:
-4px
;
margin-top
:
-2px
;
position
:
absolute
;
top
:
50%
;
width
:
0
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__clear
{
float
:
left
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__arrow
{
left
:
1px
;
right
:
auto
}
.select2-container--default.select2-container--disabled
.select2-selection--single
{
background-color
:
#eee
;
cursor
:
default
}
.select2-container--default.select2-container--disabled
.select2-selection--single
.select2-selection__clear
{
display
:
none
}
.select2-container--default.select2-container--open
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
transparent
transparent
#888
transparent
;
border-width
:
0
4px
5px
4px
}
.select2-container--default
.select2-selection--multiple
{
background-color
:
white
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
text
}
.select2-container--default
.select2-selection--multiple
.select2-selection__rendered
{
box-sizing
:
border-box
;
list-style
:
none
;
margin
:
0
;
padding
:
0
5px
;
width
:
100%
}
.select2-container--default
.select2-selection--multiple
.select2-selection__rendered
li
{
list-style
:
none
}
.select2-container--default
.select2-selection--multiple
.select2-selection__placeholder
{
color
:
#999
;
margin-top
:
5px
;
float
:
left
}
.select2-container--default
.select2-selection--multiple
.select2-selection__clear
{
cursor
:
pointer
;
float
:
right
;
font-weight
:
bold
;
margin-top
:
5px
;
margin-right
:
10px
}
.select2-container--default
.select2-selection--multiple
.select2-selection__choice
{
background-color
:
#e4e4e4
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
default
;
float
:
left
;
margin-right
:
5px
;
margin-top
:
5px
;
padding
:
0
5px
}
.select2-container--default
.select2-selection--multiple
.select2-selection__choice__remove
{
color
:
#999
;
cursor
:
pointer
;
display
:
inline-block
;
font-weight
:
bold
;
margin-right
:
2px
}
.select2-container--default
.select2-selection--multiple
.select2-selection__choice__remove
:hover
{
color
:
#333
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
,
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__placeholder
,
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-search--inline
{
float
:
right
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
{
margin-left
:
5px
;
margin-right
:
auto
}
.select2-container--default
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice__remove
{
margin-left
:
2px
;
margin-right
:
auto
}
.select2-container--default.select2-container--focus
.select2-selection--multiple
{
border
:
solid
black
1px
;
outline
:
0
}
.select2-container--default.select2-container--disabled
.select2-selection--multiple
{
background-color
:
#eee
;
cursor
:
default
}
.select2-container--default.select2-container--disabled
.select2-selection__choice__remove
{
display
:
none
}
.select2-container--default.select2-container--open.select2-container--above
.select2-selection--single
,
.select2-container--default.select2-container--open.select2-container--above
.select2-selection--multiple
{
border-top-left-radius
:
0
;
border-top-right-radius
:
0
}
.select2-container--default.select2-container--open.select2-container--below
.select2-selection--single
,
.select2-container--default.select2-container--open.select2-container--below
.select2-selection--multiple
{
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
}
.select2-container--default
.select2-search--dropdown
.select2-search__field
{
border
:
1px
solid
#aaa
}
.select2-container--default
.select2-search--inline
.select2-search__field
{
background
:
transparent
;
border
:
none
;
outline
:
0
;
box-shadow
:
none
;
-webkit-appearance
:
textfield
}
.select2-container--default
.select2-results
>
.select2-results__options
{
max-height
:
200px
;
overflow-y
:
auto
}
.select2-container--default
.select2-results__option
[
role
=
group
]
{
padding
:
0
}
.select2-container--default
.select2-results__option
[
aria-disabled
=
true
]
{
color
:
#999
}
.select2-container--default
.select2-results__option
[
aria-selected
=
true
]
{
background-color
:
#ddd
}
.select2-container--default
.select2-results__option
.select2-results__option
{
padding-left
:
1em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__group
{
padding-left
:
0
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-1em
;
padding-left
:
2em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-2em
;
padding-left
:
3em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-3em
;
padding-left
:
4em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-4em
;
padding-left
:
5em
}
.select2-container--default
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
.select2-results__option
{
margin-left
:
-5em
;
padding-left
:
6em
}
.select2-container--default
.select2-results__option--highlighted
[
aria-selected
]
{
background-color
:
#5897fb
;
color
:
white
}
.select2-container--default
.select2-results__group
{
cursor
:
default
;
display
:
block
;
padding
:
6px
}
.select2-container--classic
.select2-selection--single
{
background-color
:
#f7f7f7
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
outline
:
0
;
background-image
:
-webkit-linear-gradient
(
top
,
#fff
50%
,
#eee
100%
);
background-image
:
-o-linear-gradient
(
top
,
#fff
50%
,
#eee
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#fff
50%
,
#eee
100%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#FFFFFFFF'
,
endColorstr
=
'#FFEEEEEE'
,
GradientType
=
0
)}
.select2-container--classic
.select2-selection--single
:focus
{
border
:
1px
solid
#5897fb
}
.select2-container--classic
.select2-selection--single
.select2-selection__rendered
{
color
:
#444
;
line-height
:
28px
}
.select2-container--classic
.select2-selection--single
.select2-selection__clear
{
cursor
:
pointer
;
float
:
right
;
font-weight
:
bold
;
margin-right
:
10px
}
.select2-container--classic
.select2-selection--single
.select2-selection__placeholder
{
color
:
#999
}
.select2-container--classic
.select2-selection--single
.select2-selection__arrow
{
background-color
:
#ddd
;
border
:
none
;
border-left
:
1px
solid
#aaa
;
border-top-right-radius
:
4px
;
border-bottom-right-radius
:
4px
;
height
:
26px
;
position
:
absolute
;
top
:
1px
;
right
:
1px
;
width
:
20px
;
background-image
:
-webkit-linear-gradient
(
top
,
#eee
50%
,
#ccc
100%
);
background-image
:
-o-linear-gradient
(
top
,
#eee
50%
,
#ccc
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#eee
50%
,
#ccc
100%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#FFEEEEEE'
,
endColorstr
=
'#FFCCCCCC'
,
GradientType
=
0
)}
.select2-container--classic
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
#888
transparent
transparent
transparent
;
border-style
:
solid
;
border-width
:
5px
4px
0
4px
;
height
:
0
;
left
:
50%
;
margin-left
:
-4px
;
margin-top
:
-2px
;
position
:
absolute
;
top
:
50%
;
width
:
0
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__clear
{
float
:
left
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--single
.select2-selection__arrow
{
border
:
none
;
border-right
:
1px
solid
#aaa
;
border-radius
:
0
;
border-top-left-radius
:
4px
;
border-bottom-left-radius
:
4px
;
left
:
1px
;
right
:
auto
}
.select2-container--classic.select2-container--open
.select2-selection--single
{
border
:
1px
solid
#5897fb
}
.select2-container--classic.select2-container--open
.select2-selection--single
.select2-selection__arrow
{
background
:
transparent
;
border
:
none
}
.select2-container--classic.select2-container--open
.select2-selection--single
.select2-selection__arrow
b
{
border-color
:
transparent
transparent
#888
transparent
;
border-width
:
0
4px
5px
4px
}
.select2-container--classic.select2-container--open.select2-container--above
.select2-selection--single
{
border-top
:
none
;
border-top-left-radius
:
0
;
border-top-right-radius
:
0
;
background-image
:
-webkit-linear-gradient
(
top
,
#fff
0%
,
#eee
50%
);
background-image
:
-o-linear-gradient
(
top
,
#fff
0%
,
#eee
50%
);
background-image
:
linear-gradient
(
to
bottom
,
#fff
0%
,
#eee
50%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#FFFFFFFF'
,
endColorstr
=
'#FFEEEEEE'
,
GradientType
=
0
)}
.select2-container--classic.select2-container--open.select2-container--below
.select2-selection--single
{
border-bottom
:
none
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
;
background-image
:
-webkit-linear-gradient
(
top
,
#eee
50%
,
#fff
100%
);
background-image
:
-o-linear-gradient
(
top
,
#eee
50%
,
#fff
100%
);
background-image
:
linear-gradient
(
to
bottom
,
#eee
50%
,
#fff
100%
);
background-repeat
:
repeat-x
;
filter
:
progid
:
DXImageTransform
.
Microsoft
.
gradient
(
startColorstr
=
'#FFEEEEEE'
,
endColorstr
=
'#FFFFFFFF'
,
GradientType
=
0
)}
.select2-container--classic
.select2-selection--multiple
{
background-color
:
white
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
text
;
outline
:
0
}
.select2-container--classic
.select2-selection--multiple
:focus
{
border
:
1px
solid
#5897fb
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__rendered
{
list-style
:
none
;
margin
:
0
;
padding
:
0
5px
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__clear
{
display
:
none
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__choice
{
background-color
:
#e4e4e4
;
border
:
1px
solid
#aaa
;
border-radius
:
4px
;
cursor
:
default
;
float
:
left
;
margin-right
:
5px
;
margin-top
:
5px
;
padding
:
0
5px
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__choice__remove
{
color
:
#888
;
cursor
:
pointer
;
display
:
inline-block
;
font-weight
:
bold
;
margin-right
:
2px
}
.select2-container--classic
.select2-selection--multiple
.select2-selection__choice__remove
:hover
{
color
:
#555
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
{
float
:
right
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice
{
margin-left
:
5px
;
margin-right
:
auto
}
.select2-container--classic
[
dir
=
"rtl"
]
.select2-selection--multiple
.select2-selection__choice__remove
{
margin-left
:
2px
;
margin-right
:
auto
}
.select2-container--classic.select2-container--open
.select2-selection--multiple
{
border
:
1px
solid
#5897fb
}
.select2-container--classic.select2-container--open.select2-container--above
.select2-selection--multiple
{
border-top
:
none
;
border-top-left-radius
:
0
;
border-top-right-radius
:
0
}
.select2-container--classic.select2-container--open.select2-container--below
.select2-selection--multiple
{
border-bottom
:
none
;
border-bottom-left-radius
:
0
;
border-bottom-right-radius
:
0
}
.select2-container--classic
.select2-search--dropdown
.select2-search__field
{
border
:
1px
solid
#aaa
;
outline
:
0
}
.select2-container--classic
.select2-search--inline
.select2-search__field
{
outline
:
0
;
box-shadow
:
none
}
.select2-container--classic
.select2-dropdown
{
background-color
:
#fff
;
border
:
1px
solid
transparent
}
.select2-container--classic
.select2-dropdown--above
{
border-bottom
:
none
}
.select2-container--classic
.select2-dropdown--below
{
border-top
:
none
}
.select2-container--classic
.select2-results
>
.select2-results__options
{
max-height
:
200px
;
overflow-y
:
auto
}
.select2-container--classic
.select2-results__option
[
role
=
group
]
{
padding
:
0
}
.select2-container--classic
.select2-results__option
[
aria-disabled
=
true
]
{
color
:
grey
}
.select2-container--classic
.select2-results__option--highlighted
[
aria-selected
]
{
background-color
:
#3875d7
;
color
:
#fff
}
.select2-container--classic
.select2-results__group
{
cursor
:
default
;
display
:
block
;
padding
:
6px
}
.select2-container--classic.select2-container--open
.select2-dropdown
{
border-color
:
#5897fb
}
\ No newline at end of file
apps/static/js/jumpserver.js
View file @
15dcc760
...
@@ -178,8 +178,8 @@ function activeNav() {
...
@@ -178,8 +178,8 @@ function activeNav() {
var
url_array
=
document
.
location
.
pathname
.
split
(
"/"
);
var
url_array
=
document
.
location
.
pathname
.
split
(
"/"
);
var
app
=
url_array
[
1
];
var
app
=
url_array
[
1
];
var
resource
=
url_array
[
2
];
var
resource
=
url_array
[
2
];
if
(
app
==
''
){
if
(
app
==
=
''
){
$
(
'#index'
).
addClass
(
'active'
)
$
(
'#index'
).
addClass
(
'active'
)
;
}
else
{
}
else
{
$
(
"#"
+
app
).
addClass
(
'active'
);
$
(
"#"
+
app
).
addClass
(
'active'
);
$
(
'#'
+
app
+
' #'
+
resource
).
addClass
(
'active'
);
$
(
'#'
+
app
+
' #'
+
resource
).
addClass
(
'active'
);
...
@@ -236,8 +236,24 @@ function objectDelete(obj, name, url){
...
@@ -236,8 +236,24 @@ function objectDelete(obj, name, url){
swal
(
'Deleted!'
,
"【"
+
name
+
"】"
+
"has been deleted."
,
"success"
);
swal
(
'Deleted!'
,
"【"
+
name
+
"】"
+
"has been deleted."
,
"success"
);
$
(
obj
).
parent
().
parent
().
remove
();
$
(
obj
).
parent
().
parent
().
remove
();
}
}
})
})
;
});
});
}
}
var
jumpserver
=
{};
var
jumpserver
=
{};
$
.
fn
.
serializeObject
=
function
()
{
var
o
=
{};
var
a
=
this
.
serializeArray
();
$
.
each
(
a
,
function
()
{
if
(
o
[
this
.
name
]
!==
undefined
)
{
if
(
!
o
[
this
.
name
].
push
)
{
o
[
this
.
name
]
=
[
o
[
this
.
name
]];
}
o
[
this
.
name
].
push
(
this
.
value
||
''
);
}
else
{
o
[
this
.
name
]
=
this
.
value
||
''
;
}
});
return
o
;
};
apps/static/js/plugins/select2/select2.full.min.js
View file @
15dcc760
This source diff could not be displayed because it is too large. You can
view the blob
instead.
apps/templates/_base_list.html
View file @
15dcc760
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
{% block custom_head_css_js %}
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
dataTables
/
dataTables
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
dataTables
/
dataTables
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
awesome-bootstrap-checkbox
/
awesome-bootstrap-checkbox
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
awesome-bootstrap-checkbox
/
awesome-bootstrap-checkbox
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
select2
/
select2
.
min
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
plugins
/
select2
/
select2
.
full
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
plugins
/
dataTables
/
dataTables
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
plugins
/
dataTables
/
dataTables
.
min
.
js
"
%}"
></script>
{% endblock %}
{% endblock %}
{% block content %}
{% block content %}
...
...
apps/templates/_modal.html
View file @
15dcc760
{% load i18n %}
{% load i18n %}
<div
aria-hidden=
"true"
role=
"dialog"
tabindex=
"-1"
id=
"{% block modal_id %}{% endblock %}"
class=
"modal inmodal"
style=
"display: none;
"
>
<div
aria-hidden=
"true"
role=
"dialog"
id=
"{% block modal_id %}{% endblock %}"
class=
"modal inmodal
"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content animated fadeIn"
>
<div
class=
"modal-content animated fadeIn"
>
<div
class=
"modal-header"
>
<div
class=
"modal-header"
>
...
...
apps/users/templates/users/_user_bulk_update_modal.html
0 → 100644
View file @
15dcc760
{% extends '_modal.html' %}
{% load i18n %}
{% block modal_id %}user_bulk_update_modal{% endblock %}
{% block modal_title%}{% trans "Update User" %}{% endblock %}
{% block modal_body %}
<p
class=
"text-success text-center"
>
{% trans "Hint: only change the field you want to update." %}
</p>
<form
method=
"post"
class=
"form-horizontal"
action=
""
id=
"fm_user_bulk_update"
>
<div
class=
"form-group"
>
<label
class=
"control-label col-sm-2 col-lg-2 "
for=
"id_role"
>
{% trans "Role" %}
</label>
<div
class=
" col-sm-9 col-lg-9 "
>
<select
class=
" form-control"
id=
"id_role"
name=
"role"
>
<option
value=
""
>
---------
</option>
<option
value=
"Admin"
>
{% trans "Admin" %}
</option>
<option
value=
"User"
>
{% trans "User" %}
</option>
</select>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"groups"
class=
"col-sm-2 control-label"
>
{% trans 'Groups' %}
</label>
<div
class=
"col-sm-9"
id=
"select2-container"
>
<select
name=
"groups"
id=
"select2_groups"
data-placeholder=
"{% trans 'Select Group' %}"
class=
"select2 form-control m-b"
multiple
>
{% for group in groups %}
<option
value=
"{{ group.id }}"
>
{{ group.name }}
</option>
{% endfor %}
</select>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"col-sm-9 col-lg-9 col-sm-offset-2"
>
<div
class=
"checkbox checkbox-success"
>
<input
type=
"checkbox"
name=
"enable_otp"
checked
id=
"id_enable_otp"
><label
for=
"id_enable_otp"
>
{% trans 'Enable-OTP' %}
</label>
</div>
</div>
</div>
</form>
{% endblock %}
{% block modal_confirm_id %}btn_user_bulk_update{% endblock %}
apps/users/templates/users/user_list.html
View file @
15dcc760
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
<tbody>
<tbody>
</tbody>
</tbody>
</table>
</table>
{% include "users/_user_bulk_update_modal.html" %}
{% endblock %}
{% endblock %}
{% block content_bottom_left %}
{% block content_bottom_left %}
<div
class=
"input-group"
>
<div
class=
"input-group"
>
...
@@ -150,6 +151,7 @@ $(document).ready(function(){
...
@@ -150,6 +151,7 @@ $(document).ready(function(){
});
});
APIUpdateAttr
({
url
:
the_url
,
method
:
'PATCH'
,
body
:
JSON
.
stringify
(
body
)});
APIUpdateAttr
({
url
:
the_url
,
method
:
'PATCH'
,
body
:
JSON
.
stringify
(
body
)});
$data_table
.
ajax
.
reload
();
$data_table
.
ajax
.
reload
();
jumpserver
.
checked
=
false
;
}
}
function
doDelete
()
{
function
doDelete
()
{
swal
({
swal
({
...
@@ -172,9 +174,12 @@ $(document).ready(function(){
...
@@ -172,9 +174,12 @@ $(document).ready(function(){
};
};
var
url_delete
=
the_url
+
'?id__in='
+
JSON
.
stringify
(
plain_id_list
);
var
url_delete
=
the_url
+
'?id__in='
+
JSON
.
stringify
(
plain_id_list
);
APIUpdateAttr
({
url
:
url_delete
,
method
:
'DELETE'
,
success
:
success
,
error
:
fail
});
APIUpdateAttr
({
url
:
url_delete
,
method
:
'DELETE'
,
success
:
success
,
error
:
fail
});
jumpserver
.
checked
=
false
;
});
});
}
}
function
doUpdate
()
{}
function
doUpdate
()
{
$
(
'#user_bulk_update_modal'
).
modal
(
'show'
);
}
switch
(
action
)
{
switch
(
action
)
{
case
'deactive'
:
case
'deactive'
:
doDeactive
();
doDeactive
();
...
@@ -232,6 +237,17 @@ $(document).ready(function(){
...
@@ -232,6 +237,17 @@ $(document).ready(function(){
jumpserver
.
checked
=
false
;
jumpserver
.
checked
=
false
;
$
(
'#user_list_table'
).
DataTable
().
rows
().
deselect
();
$
(
'#user_list_table'
).
DataTable
().
rows
().
deselect
();
}
}
}).
on
(
'click'
,
'#btn_user_bulk_update'
,
function
(){
var
json_data
=
$
(
'#fm_user_bulk_update'
).
serializeObject
();
var
body
=
{};
body
.
enable_otp
=
(
json_data
.
enable_otp
===
'on'
)?
true
:
false
;
if
(
json_data
.
role
!=
''
)
{
body
.
role
=
json_data
.
role
;
}
if
(
json_data
.
groups
!=
undefined
)
{
body
.
groups
=
json_data
.
groups
;
}
console
.
log
(
body
)
})
})
</script>
</script>
{% endblock %}
{% endblock %}
...
...
apps/users/urls.py
View file @
15dcc760
...
@@ -26,7 +26,6 @@ urlpatterns = [
...
@@ -26,7 +26,6 @@ urlpatterns = [
url
(
r'^user/(?P<pk>[0-9]+)/assets-perm$'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
url
(
r'^user/(?P<pk>[0-9]+)/assets-perm$'
,
views
.
UserDetailView
.
as_view
(),
name
=
'user-detail'
),
url
(
r'^user/create$'
,
views
.
UserCreateView
.
as_view
(),
name
=
'user-create'
),
url
(
r'^user/create$'
,
views
.
UserCreateView
.
as_view
(),
name
=
'user-create'
),
url
(
r'^user/(?P<pk>[0-9]+)/update$'
,
views
.
UserUpdateView
.
as_view
(),
name
=
'user-update'
),
url
(
r'^user/(?P<pk>[0-9]+)/update$'
,
views
.
UserUpdateView
.
as_view
(),
name
=
'user-update'
),
url
(
r'^user/(?P<pk>[0-9]+)/delete$'
,
views
.
UserDeleteView
.
as_view
(),
name
=
'user-delete'
),
url
(
r'^user-group$'
,
views
.
UserGroupListView
.
as_view
(),
name
=
'user-group-list'
),
url
(
r'^user-group$'
,
views
.
UserGroupListView
.
as_view
(),
name
=
'user-group-list'
),
url
(
r'^user-group/(?P<pk>[0-9]+)$'
,
views
.
UserGroupDetailView
.
as_view
(),
name
=
'user-group-detail'
),
url
(
r'^user-group/(?P<pk>[0-9]+)$'
,
views
.
UserGroupDetailView
.
as_view
(),
name
=
'user-group-detail'
),
url
(
r'^user-group/create$'
,
views
.
UserGroupCreateView
.
as_view
(),
name
=
'user-group-create'
),
url
(
r'^user-group/create$'
,
views
.
UserGroupCreateView
.
as_view
(),
name
=
'user-group-create'
),
...
...
apps/users/views.py
View file @
15dcc760
...
@@ -7,7 +7,6 @@ from django.contrib.auth import login as auth_login, logout as auth_logout
...
@@ -7,7 +7,6 @@ from django.contrib.auth import login as auth_login, logout as auth_logout
from
django.contrib.auth.mixins
import
LoginRequiredMixin
from
django.contrib.auth.mixins
import
LoginRequiredMixin
from
django.contrib.messages.views
import
SuccessMessageMixin
from
django.contrib.messages.views
import
SuccessMessageMixin
from
django.core.files.storage
import
default_storage
from
django.core.files.storage
import
default_storage
from
django.db.models
import
Q
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
reverse
,
redirect
from
django.shortcuts
import
reverse
,
redirect
from
django.utils.decorators
import
method_decorator
from
django.utils.decorators
import
method_decorator
...
@@ -80,27 +79,12 @@ class UserLogoutView(TemplateView):
...
@@ -80,27 +79,12 @@ class UserLogoutView(TemplateView):
return
super
(
UserLogoutView
,
self
)
.
get_context_data
(
**
kwargs
)
return
super
(
UserLogoutView
,
self
)
.
get_context_data
(
**
kwargs
)
class
UserListView
(
AdminUserRequiredMixin
,
ListView
):
class
UserListView
(
AdminUserRequiredMixin
,
TemplateView
):
model
=
User
template_name
=
'users/user_list.html'
paginate_by
=
settings
.
CONFIG
.
DISPLAY_PER_PAGE
context_object_name
=
'user_list'
template_name
=
'users/asset_permission_list.html'
ordering
=
'-date_joined'
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
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserListView
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
UserListView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
_
(
'Users'
),
'action'
:
_
(
'User list'
),
'
keyword'
:
self
.
keyword
})
context
.
update
({
'app'
:
_
(
'Users'
),
'action'
:
_
(
'User list'
),
'
groups'
:
UserGroup
.
objects
.
all
()
})
return
context
return
context
...
@@ -153,26 +137,6 @@ class UserUpdateView(AdminUserRequiredMixin, UpdateView):
...
@@ -153,26 +137,6 @@ class UserUpdateView(AdminUserRequiredMixin, UpdateView):
return
context
return
context
class
UserDeleteView
(
AdminUserRequiredMixin
,
DeleteView
):
model
=
User
success_url
=
reverse_lazy
(
'users:user-list'
)
template_name
=
'users/user_delete_confirm.html'
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
"""
Calls the delete() method on the fetched object and then
redirects to the success URL.
"""
self
.
object
=
self
.
get_object
()
success_url
=
self
.
get_success_url
()
if
self
.
object
.
name
==
"admin"
or
self
.
object
.
id
==
request
.
session
.
get
(
'_auth_user_id'
):
pass
else
:
self
.
object
.
delete
()
return
HttpResponseRedirect
(
success_url
)
class
UserDetailView
(
AdminUserRequiredMixin
,
DetailView
):
class
UserDetailView
(
AdminUserRequiredMixin
,
DetailView
):
model
=
User
model
=
User
template_name
=
'users/user_detail.html'
template_name
=
'users/user_detail.html'
...
...
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