mirror of https://github.com/jumpserver/jumpserver
Add assetgroup form save action
parent
126d7fd62c
commit
b8c10a0350
|
@ -21,7 +21,10 @@ class AssetForm(forms.ModelForm):
|
||||||
|
|
||||||
|
|
||||||
class AssetGroupForm(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):
|
def __init__(self, *args, **kwargs):
|
||||||
if kwargs.get('instance'):
|
if kwargs.get('instance'):
|
||||||
|
|
|
@ -30,18 +30,18 @@
|
||||||
<form method="post" id="userForm" class="form-horizontal" action="" >
|
<form method="post" id="userForm" class="form-horizontal" action="" >
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.name|bootstrap_horizontal }}
|
{{ form.name|bootstrap_horizontal }}
|
||||||
{# {{ form.assets|bootstrap_horizontal }}#}
|
{{ form.assets|bootstrap_horizontal }}
|
||||||
|
|
||||||
<div class="form-group">
|
{# <div class="form-group">#}
|
||||||
<label for="users" class="col-sm-2 control-label">{% trans 'Asset' %}</label>
|
{# <label for="users" class="col-sm-2 control-label">{% trans 'Asset' %}</label>#}
|
||||||
<div class="col-sm-9">
|
{# <div class="col-sm-9">#}
|
||||||
<select name="assets" id="assets" data-placeholder="{% trans 'Select asset' %}" class="select2 form-control m-b" multiple tabindex="2">
|
{# <select name="assets" id="assets" data-placeholder="{% trans 'Select asset' %}" class="select2 form-control m-b" multiple tabindex="2">#}
|
||||||
{% for asset in assets %}
|
{# {% for asset in assets %}#}
|
||||||
<option value="{{ asset.id }}">{{ asset.ip }}:{{ asset.port }}</option>
|
{# <option value="{{ asset.id }}">{{ asset.ip }}:{{ asset.port }}</option>#}
|
||||||
{% endfor %}
|
{# {% endfor %}#}
|
||||||
</select>
|
{# </select>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
</div>
|
{# </div>#}
|
||||||
|
|
||||||
{{ form.comment|bootstrap_horizontal }}
|
{{ form.comment|bootstrap_horizontal }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue