2015-10-31 01:23:10 +00:00
|
|
|
# coding:utf-8
|
|
|
|
from django import forms
|
|
|
|
|
|
|
|
from jasset.models import IDC, Asset, AssetGroup
|
|
|
|
|
|
|
|
|
|
|
|
class AssetForm(forms.ModelForm):
|
2015-11-03 09:07:46 +00:00
|
|
|
|
2015-10-31 01:23:10 +00:00
|
|
|
class Meta:
|
|
|
|
model = Asset
|
2015-11-08 14:39:30 +00:00
|
|
|
|
2015-10-31 01:23:10 +00:00
|
|
|
fields = [
|
2015-11-08 14:39:30 +00:00
|
|
|
"ip", "other_ip", "hostname", "port", "group", "username", "password", "use_default_auth",
|
2015-10-31 01:23:10 +00:00
|
|
|
"idc", "mac", "remote_ip", "brand", "cpu", "memory", "disk", "system_type", "system_version",
|
|
|
|
"cabinet", "position", "number", "status", "asset_type", "env", "sn", "is_active", "comment"
|
2015-11-03 09:07:46 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
class AssetGroupForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = AssetGroup
|
|
|
|
fields = [
|
|
|
|
"name", "comment"
|
|
|
|
]
|
2015-11-12 16:03:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class IdcForm(forms.ModelForm):
|
|
|
|
class Meta:
|
|
|
|
model = IDC
|
|
|
|
fields = ['name', "bandwidth", "operator", 'linkman', 'phone', 'address', 'network', 'comment']
|
2015-11-21 10:28:25 +00:00
|
|
|
widgets = {
|
|
|
|
'name': forms.TextInput(attrs={'placeholder': 'Name'}),
|
|
|
|
'network': forms.Textarea(
|
|
|
|
attrs={'placeholder': '192.168.1.0/24\n192.168.2.0/24'})
|
|
|
|
}
|
2015-11-12 16:03:51 +00:00
|
|
|
|
|
|
|
|