1
0
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:
jeremystretch
2021-06-09 16:51:51 -04:00
parent 8a7473765e
commit b3ed545d6a
12 changed files with 183 additions and 50 deletions

View File

@@ -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=[