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
7f09b486
Commit
7f09b486
authored
Sep 06, 2016
by
xiaokong1937@gmail.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user-group edit serializer and url implement
parent
556fb4e0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
1 deletion
+16
-1
base.html
apps/templates/rest_framework/base.html
+0
-0
api.py
apps/users/api.py
+6
-1
serializers.py
apps/users/serializers.py
+8
-0
urls.py
apps/users/urls.py
+2
-0
No files found.
apps/templates/rest_framework/base.html
0 → 100644
View file @
7f09b486
This diff is collapsed.
Click to expand it.
apps/users/api.py
View file @
7f09b486
...
...
@@ -5,7 +5,7 @@ import logging
from
rest_framework
import
generics
from
.serializers
import
UserSerializer
,
UserGroupSerializer
,
UserAttributeSerializer
from
.serializers
import
UserSerializer
,
UserGroupSerializer
,
UserAttributeSerializer
,
UserGroupEditSerializer
from
.models
import
User
,
UserGroup
...
...
@@ -44,3 +44,8 @@ class UserGroupDetailDeleteUpdateApi(generics.RetrieveUpdateDestroyAPIView):
class
UserAttributeApi
(
generics
.
RetrieveUpdateDestroyAPIView
):
queryset
=
User
.
objects
.
all
()
serializer_class
=
UserAttributeSerializer
class
UserGroupEditApi
(
generics
.
RetrieveUpdateAPIView
):
queryset
=
User
.
objects
.
all
()
serializer_class
=
UserGroupEditSerializer
apps/users/serializers.py
View file @
7f09b486
...
...
@@ -30,3 +30,11 @@ class UserAttributeSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
User
fields
=
[
'avatar'
,
'wechat'
,
'phone'
,
'enable_otp'
,
'comment'
,
'is_active'
,
'name'
]
class
UserGroupEditSerializer
(
serializers
.
ModelSerializer
):
groups
=
serializers
.
PrimaryKeyRelatedField
(
many
=
True
,
queryset
=
UserGroup
.
objects
.
all
())
class
Meta
:
model
=
User
fields
=
[
'id'
,
'groups'
]
apps/users/urls.py
View file @
7f09b486
...
...
@@ -36,4 +36,6 @@ urlpatterns += [
url
(
r'^v1/user-groups$'
,
api
.
UserGroupListAddApi
.
as_view
(),
name
=
'user-group-list-api'
),
url
(
r'^v1/user-groups/(?P<pk>[0-9]+)$'
,
api
.
UserGroupDetailDeleteUpdateApi
.
as_view
(),
name
=
'user-group-detail-api'
),
url
(
r'^v1/user-groups/(?P<pk>[0-9]+)/edit$'
,
api
.
UserGroupEditApi
.
as_view
(),
name
=
'user-group-edit-api'
),
]
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