1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Clean tagged VLANs

This commit is contained in:
Saria Hajjar
2019-12-31 20:47:13 +00:00
parent 8a4293a4cc
commit 05570ae4ad

View File

@@ -74,6 +74,15 @@ class InterfaceCommonForm:
elif self.cleaned_data['mode'] == IFACE_MODE_TAGGED_ALL:
self.cleaned_data['tagged_vlans'] = []
# Validate tagged VLANs; must be a global VLAN or in the same site
else:
for tagged_vlan in tagged_vlans:
if tagged_vlan.site not in [self.cleaned_data['device'].site, None]:
raise forms.ValidationError({
'tagged_vlans': "The tagged VLAN ({}) must belong to the same site as the interface's parent "
"device/VM, or it must be global".format(tagged_vlan)
})
class BulkRenameForm(forms.Form):
"""