mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
More informative error message
This commit is contained in:
parent
1a57120b78
commit
7ad9e8a2fb
@ -76,12 +76,14 @@ class InterfaceCommonForm:
|
|||||||
|
|
||||||
# Validate tagged VLANs; must be a global VLAN or in the same site
|
# Validate tagged VLANs; must be a global VLAN or in the same site
|
||||||
else:
|
else:
|
||||||
for tagged_vlan in tagged_vlans:
|
valid_sites = [None, self.cleaned_data['device'].site]
|
||||||
if tagged_vlan.site not in [self.cleaned_data['device'].site, None]:
|
invalid_vlans = [str(v) for v in tagged_vlans if v.site not in valid_sites]
|
||||||
raise forms.ValidationError({
|
|
||||||
'tagged_vlans': "The tagged VLAN ({}) must belong to the same site as the interface's parent "
|
if invalid_vlans:
|
||||||
"device/VM, or it must be global".format(tagged_vlan)
|
raise forms.ValidationError({
|
||||||
})
|
'tagged_vlans': "The tagged VLANs ({}) must belong to the same site as the interface's parent "
|
||||||
|
"device/VM, or they must be global".format(', '.join(invalid_vlans))
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
class BulkRenameForm(forms.Form):
|
class BulkRenameForm(forms.Form):
|
||||||
|
Loading…
Reference in New Issue
Block a user