Closes #18153: Introduce virtual circuit types (#18300)

* Closes #18153: Introduce virtual circuit types

* Fix TagTestCase

* Fix GraphQL API test
This commit is contained in:
Jeremy Stretch
2025-01-06 13:37:43 -05:00
committed by GitHub
parent 89d7487197
commit 83d62315cc
29 changed files with 643 additions and 49 deletions

View File

@@ -13,7 +13,7 @@ from netbox.models.mixins import DistanceMixin
from netbox.models.features import (
ContactsMixin, CustomFieldsMixin, CustomLinksMixin, ExportTemplatesMixin, ImageAttachmentsMixin, TagsMixin,
)
from utilities.fields import ColorField
from .base import BaseCircuitType
__all__ = (
'Circuit',
@@ -24,16 +24,11 @@ __all__ = (
)
class CircuitType(OrganizationalModel):
class CircuitType(BaseCircuitType):
"""
Circuits can be organized by their functional role. For example, a user might wish to define CircuitTypes named
"Long Haul," "Metro," or "Out-of-Band".
"""
color = ColorField(
verbose_name=_('color'),
blank=True
)
class Meta:
ordering = ('name',)
verbose_name = _('circuit type')
@@ -64,7 +59,7 @@ class Circuit(ContactsMixin, ImageAttachmentsMixin, DistanceMixin, PrimaryModel)
null=True
)
type = models.ForeignKey(
to='CircuitType',
to='circuits.CircuitType',
on_delete=models.PROTECT,
related_name='circuits'
)