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
f0b0e41d
Commit
f0b0e41d
authored
Aug 21, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update user edit
parent
308aa2ec
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
forms.py
apps/users/forms.py
+7
-1
models.py
apps/users/models.py
+3
-3
No files found.
apps/users/forms.py
View file @
f0b0e41d
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
from
django.forms
import
ModelForm
from
django.forms
import
ModelForm
from
django
import
forms
from
django
import
forms
from
.models
import
User
,
UserGroup
,
Role
from
.models
import
User
,
UserGroup
class
UserAddForm
(
ModelForm
):
class
UserAddForm
(
ModelForm
):
...
@@ -41,13 +41,19 @@ class UserUpdateForm(ModelForm):
...
@@ -41,13 +41,19 @@ class UserUpdateForm(ModelForm):
'groups'
:
'* required'
'groups'
:
'* required'
}
}
widgets
=
{
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'chosen-select'
,
'data-placeholder'
:
'请选择用户组'
}),
}
class
UserGroupForm
(
ModelForm
):
class
UserGroupForm
(
ModelForm
):
class
Meta
:
class
Meta
:
model
=
UserGroup
model
=
UserGroup
fields
=
[
fields
=
[
'name'
,
'comment'
,
'name'
,
'comment'
,
]
]
help_texts
=
{
help_texts
=
{
'name'
:
'* required'
'name'
:
'* required'
}
}
apps/users/models.py
View file @
f0b0e41d
...
@@ -86,9 +86,9 @@ def date_expired_default():
...
@@ -86,9 +86,9 @@ def date_expired_default():
class
User
(
AbstractUser
):
class
User
(
AbstractUser
):
username
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
,
verbose_name
=
'用户名'
)
username
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
,
verbose_name
=
'用户名'
)
name
=
models
.
CharField
(
max_length
=
20
,
verbose_name
=
'姓名'
,
help_text
=
'* required'
)
name
=
models
.
CharField
(
max_length
=
20
,
verbose_name
=
'姓名'
)
email
=
models
.
EmailField
(
max_length
=
30
,
unique
=
True
,
verbose_name
=
'邮件'
,
help_text
=
'* required'
)
email
=
models
.
EmailField
(
max_length
=
30
,
unique
=
True
,
verbose_name
=
'邮件'
)
groups
=
models
.
ManyToManyField
(
UserGroup
,
verbose_name
=
'用户组'
,
help_text
=
'* required'
)
groups
=
models
.
ManyToManyField
(
UserGroup
,
verbose_name
=
'用户组'
)
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
=
'手机号'
)
...
...
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