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
63f3fa98
Commit
63f3fa98
authored
Jul 11, 2019
by
八千流
Committed by
BaiJiangJie
Jul 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 创建/更新 网域使用api (#2915)
* [Update] 创建/更新 网域使用api * [Update] 修改小问题 * [Update] 修改小问题
parent
4e3e1661
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletion
+29
-1
domain.py
apps/assets/serializers/domain.py
+5
-1
domain_create_update.html
apps/assets/templates/assets/domain_create_update.html
+22
-0
domain.py
apps/assets/views/domain.py
+2
-0
No files found.
apps/assets/serializers/domain.py
View file @
63f3fa98
...
...
@@ -15,7 +15,11 @@ class DomainSerializer(BulkOrgResourceModelSerializer):
class
Meta
:
model
=
Domain
fields
=
'__all__'
fields
=
[
'id'
,
'name'
,
'asset_count'
,
'gateway_count'
,
'comment'
,
'assets'
,
'date_created'
]
read_only_fields
=
(
'asset_count'
,
'gateway_count'
,
'date_created'
)
list_serializer_class
=
AdaptedBulkListSerializer
@staticmethod
...
...
apps/assets/templates/assets/domain_create_update.html
View file @
63f3fa98
...
...
@@ -48,5 +48,26 @@ $(document).ready(function () {
$
(
"#asset_list_modal"
).
modal
(
'hide'
);
})
.
on
(
"submit"
,
"form"
,
function
(
evt
)
{
evt
.
preventDefault
();
var
form
=
$
(
"form"
);
var
data
=
form
.
serializeObject
();
var
method
=
"POST"
;
var
the_url
=
'{% url "api-assets:domain-list" %}'
;
var
redirect_to
=
'{% url "assets:domain-list" %}'
;
{
%
if
type
==
"update"
%
}
the_url
=
'{% url '
api
-
assets
:
domain
-
detail
' pk=object.id %}'
;
method
=
"PUT"
;
{
%
endif
%
}
objectAttrsIsList
(
data
,
[
'assets'
]);
var
props
=
{
url
:
the_url
,
data
:
data
,
method
:
method
,
form
:
form
,
redirect_to
:
redirect_to
};
formSubmit
(
props
);
})
</script>
{% endblock %}
\ No newline at end of file
apps/assets/views/domain.py
View file @
63f3fa98
...
...
@@ -46,6 +46,7 @@ class DomainCreateView(PermissionsMixin, CreateView):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Create domain'
),
'type'
:
'create'
}
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
...
...
@@ -63,6 +64,7 @@ class DomainUpdateView(PermissionsMixin, UpdateView):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Update domain'
),
'type'
:
'update'
}
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
...
...
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