mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge branch 'develop' into feature
This commit is contained in:
@@ -258,11 +258,18 @@ class IPAddressCSVForm(CustomFieldModelCSVForm):
|
||||
|
||||
device = self.cleaned_data.get('device')
|
||||
virtual_machine = self.cleaned_data.get('virtual_machine')
|
||||
interface = self.cleaned_data.get('interface')
|
||||
is_primary = self.cleaned_data.get('is_primary')
|
||||
|
||||
# Validate is_primary
|
||||
if is_primary and not device and not virtual_machine:
|
||||
raise forms.ValidationError("No device or virtual machine specified; cannot set as primary IP")
|
||||
raise forms.ValidationError({
|
||||
"is_primary": "No device or virtual machine specified; cannot set as primary IP"
|
||||
})
|
||||
if is_primary and not interface:
|
||||
raise forms.ValidationError({
|
||||
"is_primary": "No interface specified; cannot set as primary IP"
|
||||
})
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user