Commit b8c10a03 authored by ibuler's avatar ibuler

Add assetgroup form save action

parent 126d7fd6
......@@ -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'):
......
......@@ -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 }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment