|
|
@ -37,13 +37,13 @@ class AssetCreateForm(forms.ModelForm):
|
|
|
|
self.instance.tags.clear()
|
|
|
|
self.instance.tags.clear()
|
|
|
|
self.instance.tags.add(*tuple(tags))
|
|
|
|
self.instance.tags.add(*tuple(tags))
|
|
|
|
|
|
|
|
|
|
|
|
def clean(self):
|
|
|
|
# def clean(self):
|
|
|
|
clean_data = super(AssetCreateForm, self).clean()
|
|
|
|
# clean_data = super(AssetCreateForm, self).clean()
|
|
|
|
ip = clean_data.get('ip')
|
|
|
|
# ip = clean_data.get('ip')
|
|
|
|
port = clean_data.get('port')
|
|
|
|
# port = clean_data.get('port')
|
|
|
|
query = Asset.objects.filter(ip=ip, port=port)
|
|
|
|
# query = Asset.objects.filter(ip=ip, port=port)
|
|
|
|
if query:
|
|
|
|
# if query:
|
|
|
|
raise forms.ValidationError('this asset has exists.')
|
|
|
|
# raise forms.ValidationError('this asset has exists.')
|
|
|
|
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
class Meta:
|
|
|
|
model = Asset
|
|
|
|
model = Asset
|
|
|
|