mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-09 00:58:16 -06:00
9627 initial commit
This commit is contained in:
parent
c6553c45dd
commit
26a96fb06f
@ -1,5 +1,6 @@
|
||||
from django import forms
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.forms import IntegerRangeField, SimpleArrayField
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
@ -632,10 +633,15 @@ class VLANGroupForm(NetBoxModelForm):
|
||||
}
|
||||
)
|
||||
slug = SlugField()
|
||||
# vlan_id_ranges = SimpleArrayField(
|
||||
# IntegerRangeField(),
|
||||
# delimiter="|"
|
||||
# )
|
||||
vlan_id_ranges = IntegerRangeField()
|
||||
|
||||
fieldsets = (
|
||||
FieldSet('name', 'slug', 'description', 'tags', name=_('VLAN Group')),
|
||||
FieldSet('min_vid', 'max_vid', name=_('Child VLANs')),
|
||||
FieldSet('min_vid', 'max_vid', 'vlan_id_ranges', name=_('Child VLANs')),
|
||||
FieldSet(
|
||||
'scope_type', 'region', 'sitegroup', 'site', 'location', 'rack', 'clustergroup', 'cluster',
|
||||
name=_('Scope')
|
||||
@ -646,7 +652,7 @@ class VLANGroupForm(NetBoxModelForm):
|
||||
model = VLANGroup
|
||||
fields = [
|
||||
'name', 'slug', 'description', 'scope_type', 'region', 'sitegroup', 'site', 'location', 'rack',
|
||||
'clustergroup', 'cluster', 'min_vid', 'max_vid', 'tags',
|
||||
'clustergroup', 'cluster', 'min_vid', 'max_vid', 'vlan_id_ranges', 'tags',
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -251,6 +251,7 @@ class VLANType(NetBoxObjectType):
|
||||
class VLANGroupType(OrganizationalObjectType):
|
||||
|
||||
vlans: List[VLANType]
|
||||
vlan_id_ranges: List[int]
|
||||
|
||||
@strawberry_django.field
|
||||
def scope(self) -> Annotated[Union[
|
||||
|
@ -1,4 +1,5 @@
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
|
||||
from django.contrib.postgres.fields import ArrayField, BigIntegerRangeField
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from django.db import models
|
||||
@ -63,6 +64,13 @@ class VLANGroup(OrganizationalModel):
|
||||
),
|
||||
help_text=_('Highest permissible ID of a child VLAN')
|
||||
)
|
||||
vlan_id_ranges = ArrayField(
|
||||
BigIntegerRangeField(),
|
||||
verbose_name=_('min/max VLAN IDs'),
|
||||
help_text=_('Ranges of Minimum, maximum VLAN IDs'),
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
|
||||
objects = VLANGroupQuerySet.as_manager()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user