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
4e3e1661
Commit
4e3e1661
authored
Jul 11, 2019
by
八千流
Committed by
BaiJiangJie
Jul 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 创建/更新 用户组使用api (#2914)
* [Update] 创建/更新 用户组使用api * [Update] 修改小问题
parent
5f9f970a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
user_group_create_update.html
apps/users/templates/users/user_group_create_update.html
+21
-0
group.py
apps/users/views/group.py
+2
-0
No files found.
apps/users/templates/users/user_group_create_update.html
View file @
4e3e1661
...
...
@@ -47,5 +47,26 @@ $(document).ready(function () {
closeOnSelect
:
false
});
})
.
on
(
"submit"
,
"form"
,
function
(
evt
)
{
evt
.
preventDefault
();
var
the_url
=
'{% url '
api
-
users
:
user
-
group
-
list
' %}'
;
var
redirect_to
=
'{% url "users:user-group-list" %}'
;
var
method
=
"POST"
;
{
%
if
type
==
"update"
%
}
the_url
=
'{% url '
api
-
users
:
user
-
group
-
detail
' pk=object.id %}'
;
method
=
"PUT"
;
{
%
endif
%
}
var
form
=
$
(
"form"
);
var
data
=
form
.
serializeObject
();
objectAttrsIsList
(
data
,
[
'users'
]);
var
props
=
{
url
:
the_url
,
data
:
data
,
method
:
method
,
form
:
form
,
redirect_to
:
redirect_to
};
formSubmit
(
props
);
})
</script>
{% endblock %}
apps/users/views/group.py
View file @
4e3e1661
...
...
@@ -44,6 +44,7 @@ class UserGroupCreateView(PermissionsMixin, SuccessMessageMixin, CreateView):
context
=
{
'app'
:
_
(
'Users'
),
'action'
:
_
(
'Create user group'
),
'type'
:
'create'
}
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
...
...
@@ -61,6 +62,7 @@ class UserGroupUpdateView(PermissionsMixin, SuccessMessageMixin, UpdateView):
context
=
{
'app'
:
_
(
'Users'
),
'action'
:
_
(
'Update user group'
),
'type'
:
'update'
}
kwargs
.
update
(
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