mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #3682: Add color field to front and rear ports
This commit is contained in:
@@ -6,7 +6,7 @@ from dcim.choices import *
|
||||
from dcim.constants import *
|
||||
from extras.utils import extras_features
|
||||
from netbox.models import ChangeLoggedModel
|
||||
from utilities.fields import NaturalOrderingField
|
||||
from utilities.fields import ColorField, NaturalOrderingField
|
||||
from utilities.querysets import RestrictedQuerySet
|
||||
from utilities.ordering import naturalize_interface
|
||||
from .device_components import (
|
||||
@@ -267,6 +267,9 @@ class FrontPortTemplate(ComponentTemplateModel):
|
||||
max_length=50,
|
||||
choices=PortTypeChoices
|
||||
)
|
||||
color = ColorField(
|
||||
blank=True
|
||||
)
|
||||
rear_port = models.ForeignKey(
|
||||
to='dcim.RearPortTemplate',
|
||||
on_delete=models.CASCADE,
|
||||
@@ -314,6 +317,7 @@ class FrontPortTemplate(ComponentTemplateModel):
|
||||
name=self.name,
|
||||
label=self.label,
|
||||
type=self.type,
|
||||
color=self.color,
|
||||
rear_port=rear_port,
|
||||
rear_port_position=self.rear_port_position
|
||||
)
|
||||
@@ -328,6 +332,9 @@ class RearPortTemplate(ComponentTemplateModel):
|
||||
max_length=50,
|
||||
choices=PortTypeChoices
|
||||
)
|
||||
color = ColorField(
|
||||
blank=True
|
||||
)
|
||||
positions = models.PositiveSmallIntegerField(
|
||||
default=1,
|
||||
validators=[
|
||||
@@ -346,6 +353,7 @@ class RearPortTemplate(ComponentTemplateModel):
|
||||
name=self.name,
|
||||
label=self.label,
|
||||
type=self.type,
|
||||
color=self.color,
|
||||
positions=self.positions
|
||||
)
|
||||
|
||||
|
@@ -12,7 +12,7 @@ from dcim.constants import *
|
||||
from dcim.fields import MACAddressField
|
||||
from extras.utils import extras_features
|
||||
from netbox.models import PrimaryModel
|
||||
from utilities.fields import NaturalOrderingField
|
||||
from utilities.fields import ColorField, NaturalOrderingField
|
||||
from utilities.mptt import TreeManager
|
||||
from utilities.ordering import naturalize_interface
|
||||
from utilities.querysets import RestrictedQuerySet
|
||||
@@ -614,6 +614,9 @@ class FrontPort(ComponentModel, CableTermination):
|
||||
max_length=50,
|
||||
choices=PortTypeChoices
|
||||
)
|
||||
color = ColorField(
|
||||
blank=True
|
||||
)
|
||||
rear_port = models.ForeignKey(
|
||||
to='dcim.RearPort',
|
||||
on_delete=models.CASCADE,
|
||||
@@ -663,6 +666,9 @@ class RearPort(ComponentModel, CableTermination):
|
||||
max_length=50,
|
||||
choices=PortTypeChoices
|
||||
)
|
||||
color = ColorField(
|
||||
blank=True
|
||||
)
|
||||
positions = models.PositiveSmallIntegerField(
|
||||
default=1,
|
||||
validators=[
|
||||
|
Reference in New Issue
Block a user