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

Fix up VLANGroup tests

This commit is contained in:
Jeremy Stretch
2021-03-15 20:35:18 -04:00
parent c0c4eed3a8
commit bb6360cad4
6 changed files with 82 additions and 63 deletions

View File

@@ -72,6 +72,15 @@ class VLANGroup(OrganizationalModel):
def get_absolute_url(self):
return reverse('ipam:vlangroup_vlans', args=[self.pk])
def clean(self):
super().clean()
# Validate scope assignment
if self.scope_type and not self.scope_id:
raise ValidationError("Cannot set scope_type without scope_id.")
if self.scope_id and not self.scope_type:
raise ValidationError("Cannot set scope_id without scope_type.")
def to_csv(self):
return (
self.name,