mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 08:38:16 -06:00
Remove default value from vlan_id_ranges
This commit is contained in:
parent
46a40c5745
commit
3c2392c9c2
@ -15,7 +15,7 @@ from utilities.exceptions import PermissionsViolation
|
||||
from utilities.forms import add_blank_choice
|
||||
from utilities.forms.fields import (
|
||||
CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, NumericArrayField,
|
||||
SlugField, NumericRangeArrayField
|
||||
NumericRangeArrayField, SlugField
|
||||
)
|
||||
from utilities.forms.rendering import FieldSet, InlineFields, ObjectAttribute, TabbedGroups
|
||||
from utilities.forms.widgets import DatePicker
|
||||
|
@ -1,11 +1,7 @@
|
||||
# Generated by Django 4.2.11 on 2024-06-20 19:28
|
||||
|
||||
import django.contrib.postgres.fields
|
||||
import django.contrib.postgres.fields.ranges
|
||||
from django.db import migrations, models
|
||||
from django.db.backends.postgresql.psycopg_any import NumericRange
|
||||
from ipam.constants import VLAN_VID_MIN, VLAN_VID_MAX
|
||||
import ipam.models.vlans
|
||||
|
||||
|
||||
def move_min_max(apps, schema_editor):
|
||||
@ -33,8 +29,9 @@ class Migration(migrations.Migration):
|
||||
name='vlan_id_ranges',
|
||||
field=django.contrib.postgres.fields.ArrayField(
|
||||
base_field=django.contrib.postgres.fields.ranges.IntegerRangeField(),
|
||||
blank=True, null=True, size=None,
|
||||
default=ipam.models.vlans.get_default_vlan_ids,
|
||||
blank=True,
|
||||
null=True,
|
||||
size=None,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
|
@ -3,7 +3,6 @@ from django.contrib.postgres.fields import ArrayField, IntegerRangeField
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from django.db import models
|
||||
from django.db.backends.postgresql.psycopg_any import NumericRange
|
||||
from django.urls import reverse
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
@ -21,10 +20,6 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
def get_default_vlan_ids():
|
||||
return [NumericRange(VLAN_VID_MIN, VLAN_VID_MAX)]
|
||||
|
||||
|
||||
class VLANGroup(OrganizationalModel):
|
||||
"""
|
||||
A VLAN group is an arbitrary collection of VLANs within which VLAN IDs and names must be unique.
|
||||
@ -55,7 +50,6 @@ class VLANGroup(OrganizationalModel):
|
||||
vlan_id_ranges = ArrayField(
|
||||
IntegerRangeField(),
|
||||
verbose_name=_('VLAN ID ranges'),
|
||||
default=get_default_vlan_ids,
|
||||
blank=True,
|
||||
null=True
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.db.models import Count, Func, F, OuterRef, Q, Subquery, Value
|
||||
from django.db.models import Count, F, OuterRef, Q, Subquery, Value
|
||||
from django.db.models.expressions import RawSQL
|
||||
from django.db.models.functions import Round
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user