Commit 47b69a9e authored by Toralf Neby berge's avatar Toralf Neby berge
Browse files

Remove unnecessary if statement

parent 7de3e400
......@@ -20,11 +20,10 @@ class InterfaceForm(forms.ModelForm):
macaddr = self.cleaned_data['macaddr']
ip4address = self.cleaned_data['ip4address']
if Interface.objects.filter(macaddr=macaddr).exists():
for interface in Interface.objects.filter(macaddr=macaddr):
subnet = interface.ip4address.subnet
if subnet == ip4address.subnet and interface != self.instance:
raise ValidationError('Macaddr already in this subnet')
for interface in Interface.objects.filter(macaddr=macaddr):
subnet = interface.ip4address.subnet
if subnet == ip4address.subnet and interface != self.instance:
raise ValidationError('Macaddr already in this subnet')
def __init__(self, *args, **kwargs):
super(InterfaceForm, self).__init__(*args, **kwargs)
......
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