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

Miscellaneous RestrictedQuerySet cleanup

This commit is contained in:
Jeremy Stretch
2020-07-09 15:11:18 -04:00
parent 26e81546eb
commit 4f00b5af4a
8 changed files with 21 additions and 14 deletions

View File

@ -868,9 +868,9 @@ class VLANGroup(ChangeLoggedModel):
"""
Return the first available VLAN ID (1-4094) in the group.
"""
vids = [vlan['vid'] for vlan in self.vlans.order_by('vid').values('vid')]
vlan_ids = VLAN.objects.unrestricted().filter(group=self).values_list('vid', flat=True)
for i in range(1, 4095):
if i not in vids:
if i not in vlan_ids:
return i
return None