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
27998792
Commit
27998792
authored
Aug 17, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify user detail of usergroup
parent
824b1c7f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
89 additions
and
23 deletions
+89
-23
default1.png
apps/media/avatar/default/default1.png
+0
-0
default2.png
apps/media/avatar/default/default2.png
+0
-0
default3.png
apps/media/avatar/default/default3.png
+0
-0
default4.png
apps/media/avatar/default/default4.png
+0
-0
default5.png
apps/media/avatar/default/default5.png
+0
-0
default6.png
apps/media/avatar/default/default6.png
+0
-0
chosen.css
apps/static/css/plugins/chosen/chosen.css
+0
-0
style.css
apps/static/css/style.css
+16
-0
_head_css_js.html
apps/templates/_head_css_js.html
+1
-2
base.html
apps/templates/base.html
+4
-1
0008_auto_20160817_2303.py
apps/users/migrations/0008_auto_20160817_2303.py
+20
-0
models.py
apps/users/models.py
+1
-1
_user.html
apps/users/templates/users/_user.html
+1
-2
user_detail.html
apps/users/templates/users/user_detail.html
+35
-10
users_tags.py
apps/users/templatetags/users_tags.py
+9
-6
views.py
apps/users/views.py
+2
-1
No files found.
apps/media/avatar/default/default1.png
0 → 100644
View file @
27998792
2.61 KB
apps/media/avatar/default/default2.png
0 → 100644
View file @
27998792
2.29 KB
apps/media/avatar/default/default3.png
0 → 100644
View file @
27998792
3.75 KB
apps/media/avatar/default/default4.png
0 → 100644
View file @
27998792
1.11 KB
apps/media/avatar/default/default5.png
0 → 100644
View file @
27998792
1.8 KB
apps/media/avatar/default/default6.png
0 → 100644
View file @
27998792
1.3 KB
apps/static/css/plugins/chosen/chosen.css
View file @
27998792
This diff is collapsed.
Click to expand it.
apps/static/css/style.css
View file @
27998792
...
@@ -981,6 +981,22 @@ button.dim:active:before {
...
@@ -981,6 +981,22 @@ button.dim:active:before {
padding
:
3px
20px
3px
5px
;
padding
:
3px
20px
3px
5px
;
position
:
relative
;
position
:
relative
;
}
}
.chosen-container
.chosen-results
li
.highlighted
{
background-color
:
#1ab394
;
background-image
:
-webkit-gradient
(
linear
,
50%
0%
,
50%
100%
,
color-stop
(
20%
,
#1ab394
),
color-stop
(
90%
,
#1ab394
));
/*background-image: -webkit-linear-gradient(#1ab394 20%, #2a62bc 100%);*/
/*background-image: -moz-linear-gradient(#1ab394 20%, #2a62bc 100%);*/
/*background-image: -o-linear-gradient(#1ab394 20%, #2a62bc 100%);*/
/*background-image: linear-gradient(#1ab394 20%, #2a62bc 100%);*/
color
:
#fff
;
}
.chosen-container-active
.chosen-choices
{
border
:
1px
solid
#1ab394
;
box-shadow
:
0
0
5px
rgba
(
0
,
0
,
0
,
0.3
);
}
/* PAGINATIN */
/* PAGINATIN */
.pagination
>
.active
>
a
,
.pagination
>
.active
>
a
,
.pagination
>
.active
>
span
,
.pagination
>
.active
>
span
,
...
...
apps/templates/_head_css_js.html
View file @
27998792
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<link
href=
"{% static "
css
/
font-awesome
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
font-awesome
.
css
"
%}"
rel=
"stylesheet"
>
{#
<link
href=
"{% static "
css
/
plugins
/
iCheck
/
custom
.
css
"
%}"
rel=
"stylesheet"
>
#}
{#
<link
href=
"{% static "
css
/
plugins
/
iCheck
/
custom
.
css
"
%}"
rel=
"stylesheet"
>
#}
{#
<link
href=
"{% static "
css
/
animate
.
css
"
%}"
rel=
"stylesheet"
>
#}
{#
<link
href=
"{% static "
css
/
animate
.
css
"
%}"
rel=
"stylesheet"
>
#}
<link
href=
"{% static "
css
/
style
.
css
"
%}"
rel=
"stylesheet"
>
{#
<link
href=
"{% static "
css
/
colorbox
.
css
"
%}"
rel=
"stylesheet"
>
#}
{#
<link
href=
"{% static "
css
/
colorbox
.
css
"
%}"
rel=
"stylesheet"
>
#}
<link
href=
"{% static "
css
/
plugins
/
vaildator
/
jquery
.
validator
.
css
"
%}"
rel=
"stylesheet"
>
<link
href=
"{% static "
css
/
plugins
/
vaildator
/
jquery
.
validator
.
css
"
%}"
rel=
"stylesheet"
>
{#
<link
href=
"{% static "
css
/
magnific
/
magnific-popup
.
css
"
%}"
rel=
"stylesheet"
>
#}
{#
<link
href=
"{% static "
css
/
magnific
/
magnific-popup
.
css
"
%}"
rel=
"stylesheet"
>
#}
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
<!-- scripts -->
<!-- scripts -->
<script
src=
"{% static "
js
/
jquery-2
.
1
.
1
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
jquery-2
.
1
.
1
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
bootstrap
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
bootstrap
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
base
.
js
"
%}"
></script>
<!-- validator js -->
<!-- validator js -->
{#
<script
src=
"{% static "
js
/
validator
/
jquery
.
validator
.
js
"
%}"
></script>
#}
{#
<script
src=
"{% static "
js
/
validator
/
jquery
.
validator
.
js
"
%}"
></script>
#}
...
...
apps/templates/base.html
View file @
27998792
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
<link
rel=
"shortcut icon"
href=
{%
static
"
img
/
facio
.
ico
"
%}
type=
"image/x-icon"
>
<link
rel=
"shortcut icon"
href=
{%
static
"
img
/
facio
.
ico
"
%}
type=
"image/x-icon"
>
{% include '_head_css_js.html' %}
{% include '_head_css_js.html' %}
{% block custom_head_css_js %} {% endblock %}
{% block custom_head_css_js %} {% endblock %}
<link
href=
"{% static "
css
/
style
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
base
.
js
"
%}"
></script>
</head>
</head>
<body>
<body>
...
@@ -25,5 +27,5 @@
...
@@ -25,5 +27,5 @@
</body>
</body>
{% include '_foot_js.html' %}
{% include '_foot_js.html' %}
{% block custom_foot
er
_js %} {% endblock %}
{% block custom_foot_js %} {% endblock %}
</html>
</html>
\ No newline at end of file
apps/users/migrations/0008_auto_20160817_2303.py
0 → 100644
View file @
27998792
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-17 15:03
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'users'
,
'0007_auto_20160817_0032'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'user'
,
name
=
'avatar'
,
field
=
models
.
ImageField
(
upload_to
=
'avatar'
,
verbose_name
=
'
\u5934\u50cf
'
),
),
]
apps/users/models.py
View file @
27998792
...
@@ -60,7 +60,7 @@ class User(AbstractUser):
...
@@ -60,7 +60,7 @@ class User(AbstractUser):
username
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
,
verbose_name
=
'用户名'
,
help_text
=
'* required'
)
username
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
,
verbose_name
=
'用户名'
,
help_text
=
'* required'
)
name
=
models
.
CharField
(
max_length
=
20
,
verbose_name
=
'姓名'
,
help_text
=
'* required'
)
name
=
models
.
CharField
(
max_length
=
20
,
verbose_name
=
'姓名'
,
help_text
=
'* required'
)
email
=
models
.
EmailField
(
max_length
=
30
,
unique
=
True
,
verbose_name
=
'邮件'
,
help_text
=
'* required'
)
email
=
models
.
EmailField
(
max_length
=
30
,
unique
=
True
,
verbose_name
=
'邮件'
,
help_text
=
'* required'
)
groups
=
models
.
ManyToManyField
(
UserGroup
,
verbose_name
=
'用户组'
)
groups
=
models
.
ManyToManyField
(
UserGroup
,
verbose_name
=
'用户组'
,
help_text
=
'* required'
)
avatar
=
models
.
ImageField
(
upload_to
=
"avatar"
,
verbose_name
=
'头像'
)
avatar
=
models
.
ImageField
(
upload_to
=
"avatar"
,
verbose_name
=
'头像'
)
wechat
=
models
.
CharField
(
max_length
=
30
,
blank
=
True
,
verbose_name
=
'微信'
)
wechat
=
models
.
CharField
(
max_length
=
30
,
blank
=
True
,
verbose_name
=
'微信'
)
phone
=
models
.
CharField
(
max_length
=
20
,
blank
=
True
,
verbose_name
=
'手机号'
)
phone
=
models
.
CharField
(
max_length
=
20
,
blank
=
True
,
verbose_name
=
'手机号'
)
...
...
apps/users/templates/users/_user.html
View file @
27998792
...
@@ -49,7 +49,6 @@
...
@@ -49,7 +49,6 @@
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<div
class=
"hr-line-dashed"
></div>
<h3>
信息
</h3>
<h3>
信息
</h3>
{{ form.avatar|bootstrap_horizontal }}
{{ form.phone|bootstrap_horizontal }}
{{ form.phone|bootstrap_horizontal }}
{{ form.wechat|bootstrap_horizontal }}
{{ form.wechat|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }}
...
@@ -67,7 +66,7 @@
...
@@ -67,7 +66,7 @@
</div>
</div>
</div>
</div>
{% endblock %}
{% endblock %}
{% block custom_foot
er
_js %}
{% block custom_foot_js %}
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
{
#
$
(
document
).
ready
(
function
()
{
#
}
{
#
$
(
document
).
ready
(
function
()
{
#
}
{
#
var
config
=
{
#
}
{
#
var
config
=
{
#
}
...
...
apps/users/templates/users/user_detail.html
View file @
27998792
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
{% load users_tags %}
{% load users_tags %}
{% load static %}
{% load static %}
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
chosen
/
chosen
.
css
"
%}"
rel=
"stylesheet"
>
<script
src=
"{% static "
js
/
plugins
/
chosen
/
chosen
.
jquery
.
min
.
js
"
%}"
></script>
{% endblock %}
{% block content %}
{% block content %}
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"wrapper wrapper-content animated fadeInRight"
>
<div
class=
"row"
>
<div
class=
"row"
>
...
@@ -177,28 +181,38 @@
...
@@ -177,28 +181,38 @@
</div>
</div>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title bg-primary"
style=
"background: #
23c6c8
"
>
<div
class=
"ibox-title bg-primary"
style=
"background: #
1ab394
"
>
<span
style=
"color: white"
>
用户组
</span>
<span
style=
"color: white"
>
用户组
</span>
<div
class=
"ibox-tools"
>
<div
class=
"ibox-tools"
>
</div>
</div>
</div>
</div>
<div
class=
"ibox-content
info
-panel"
>
<div
class=
"ibox-content
primary
-panel"
>
<table
class=
"table"
>
<table
class=
"table"
>
<tbody>
<tbody>
<tr>
<form>
<td>
<tr>
<td
colspan=
"2"
class=
"no-borders"
>
<select
data-placeholder=
"选择用户组"
class=
"chosen-select"
style=
"width: 100%"
multiple=
""
tabindex=
"4"
>
{% for group in groups %}
<option
value=
"{{ group.id }}"
>
{{ group.name }}
</option>
{% endfor %}
</select>
</td>
</td>
</tr>
</tr>
<tr>
<tr>
<td
width=
"20%"
>
姓名:
</td>
<td
colspan=
"2"
class=
"no-borders"
>
<td>
{{ user.name }}
</td>
<button
type=
"button"
class=
"btn btn-primary btn-small"
>
添加到用户组
</button>
</td>
</tr>
</tr>
</form>
{% for group in user.groups.all %}
<tr>
<tr>
<td
>
描述:
</td>
<td
width=
"40%"
><b>
{{ group.name }}
</b>
</td>
<td>
{{ user.comment }}
</td>
<td></td>
</tr>
</tr>
{% endfor %}
</tbody>
</tbody>
</table>
</table>
</div>
</div>
...
@@ -212,9 +226,19 @@
...
@@ -212,9 +226,19 @@
</div>
</div>
{% endblock %}
{% endblock %}
{% block custom_foot
er
_js %}
{% block custom_foot_js %}
<script>
<script>
$
(
document
).
ready
(
function
()
{
$
(
document
).
ready
(
function
()
{
var
config
=
{
'.chosen-select'
:
{},
'.chosen-select-deselect'
:
{
allow_single_deselect
:
true
},
'.chosen-select-no-single'
:
{
disable_search_threshold
:
10
},
'.chosen-select-no-results'
:
{
no_results_text
:
'Oops, nothing found!'
},
'.chosen-select-width'
:
{
width
:
"95%"
}
};
for
(
var
selector
in
config
)
{
$
(
selector
).
chosen
(
config
[
selector
]);
}
})
})
</script>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
apps/users/templatetags/users_tags.py
View file @
27998792
# ~*~ coding: utf-8 ~*~
# ~*~ coding: utf-8 ~*~
import
os
import
urllib
import
urllib
import
hashlib
import
hashlib
from
django
import
template
from
django
import
template
from
django.utils
import
timezone
from
django.utils
import
timezone
from
django.conf
import
settings
from
django.conf
import
settings
from
django.conf.urls.static
import
static
register
=
template
.
Library
()
register
=
template
.
Library
()
...
@@ -26,13 +26,16 @@ def is_expired(datetime):
...
@@ -26,13 +26,16 @@ def is_expired(datetime):
@register.filter
@register.filter
def
user_avatar_url
(
user
,
size
=
64
):
def
user_avatar_url
(
user
):
if
user
.
avatar
:
if
user
.
avatar
:
return
user
.
avatar
.
url
return
user
.
avatar
.
url
gravatar_url
=
"https://www.gravatar.com/avatar/"
\
else
:
+
hashlib
.
md5
(
user
.
email
.
lower
())
.
hexdigest
()
+
"?"
default_dir
=
os
.
path
.
join
(
settings
.
MEDIA_ROOT
,
'avatar'
,
'default'
)
gravatar_url
+=
urllib
.
urlencode
({
'd'
:
'identicon'
,
's'
:
str
(
size
)})
if
os
.
path
.
isdir
(
default_dir
):
return
gravatar_url
default_avatar_list
=
os
.
listdir
(
default_dir
)
default_avatar
=
default_avatar_list
[
len
(
user
.
username
)
%
len
(
default_avatar_list
)]
return
os
.
path
.
join
(
settings
.
MEDIA_URL
,
'avatar'
,
'default'
,
default_avatar
)
return
'https://www.gravatar.com/avatar/c6812ab450230979465d7bf288eadce2a?s=120&d=identicon'
apps/users/views.py
View file @
27998792
...
@@ -87,5 +87,6 @@ class UserDetailView(DetailView):
...
@@ -87,5 +87,6 @@ class UserDetailView(DetailView):
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
UserDetailView
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
'path1'
:
'用户管理'
,
'path2'
:
'用户详情'
,
'title'
:
'用户详情'
})
groups
=
[
group
for
group
in
UserGroup
.
objects
.
iterator
()
if
group
not
in
self
.
object
.
groups
.
iterator
()]
context
.
update
({
'path1'
:
'用户管理'
,
'path2'
:
'用户详情'
,
'title'
:
'用户详情'
,
'groups'
:
groups
})
return
context
return
context
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