Converted interface connections import view to new scheme

This commit is contained in:
Jeremy Stretch
2017-06-05 15:04:23 -04:00
parent af604aba31
commit 0e863ff9ca
3 changed files with 65 additions and 74 deletions

View File

@@ -1393,10 +1393,13 @@ class InterfaceConnection(models.Model):
verbose_name='Status')
def clean(self):
if self.interface_a == self.interface_b:
raise ValidationError({
'interface_b': "Cannot connect an interface to itself."
})
try:
if self.interface_a == self.interface_b:
raise ValidationError({
'interface_b': "Cannot connect an interface to itself."
})
except ObjectDoesNotExist:
pass
# Used for connections export
def to_csv(self):