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
b8c10a03
Commit
b8c10a03
authored
Sep 05, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add assetgroup form save action
parent
126d7fd6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
12 deletions
+15
-12
forms.py
apps/assets/forms.py
+4
-1
assetgroup_add.html
apps/assets/templates/assets/assetgroup_add.html
+11
-11
No files found.
apps/assets/forms.py
View file @
b8c10a03
...
...
@@ -21,7 +21,10 @@ class AssetForm(forms.ModelForm):
class
AssetGroupForm
(
forms
.
ModelForm
):
assets
=
forms
.
ModelMultipleChoiceField
(
queryset
=
Asset
.
objects
.
all
())
assets
=
forms
.
ModelMultipleChoiceField
(
queryset
=
Asset
.
objects
.
all
(),
widget
=
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Select assets'
)}))
def
__init__
(
self
,
*
args
,
**
kwargs
):
if
kwargs
.
get
(
'instance'
):
...
...
apps/assets/templates/assets/assetgroup_add.html
View file @
b8c10a03
...
...
@@ -30,18 +30,18 @@
<form
method=
"post"
id=
"userForm"
class=
"form-horizontal"
action=
""
>
{% csrf_token %}
{{ form.name|bootstrap_horizontal }}
{# {{ form.assets|bootstrap_horizontal }}#
}
{{ form.assets|bootstrap_horizontal }
}
<div
class=
"form-group"
>
<label
for=
"users"
class=
"col-sm-2 control-label"
>
{% trans 'Asset' %}
</label>
<div
class=
"col-sm-9"
>
<select
name=
"assets"
id=
"assets"
data-placeholder=
"{% trans 'Select asset' %}"
class=
"select2 form-control m-b"
multiple
tabindex=
"2"
>
{% for asset in assets %
}
<option
value=
"{{ asset.id }}"
>
{{ asset.ip }}:{{ asset.port }}
</option>
{% endfor %
}
</select>
</div>
</div>
{#
<div
class=
"form-group"
>
#}
{#
<label
for=
"users"
class=
"col-sm-2 control-label"
>
{% trans 'Asset' %}
</label>
#}
{#
<div
class=
"col-sm-9"
>
#}
{#
<select
name=
"assets"
id=
"assets"
data-placeholder=
"{% trans 'Select asset' %}"
class=
"select2 form-control m-b"
multiple
tabindex=
"2"
>
#}
{# {% for asset in assets %}#
}
{#
<option
value=
"{{ asset.id }}"
>
{{ asset.ip }}:{{ asset.port }}
</option>
#}
{# {% endfor %}#
}
{#
</select>
#}
{#
</div>
#}
{#
</div>
#}
{{ form.comment|bootstrap_horizontal }}
...
...
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