Просмотр исходного кода

CircuitTermination and PowerFeed are path endpoints

Jeremy Stretch 5 лет назад
Родитель
Сommit
8abc05544c

+ 2 - 2
netbox/circuits/models.py

@@ -4,7 +4,7 @@ from taggit.managers import TaggableManager
 
 from dcim.constants import CONNECTION_STATUS_CHOICES
 from dcim.fields import ASNField
-from dcim.models import CableTermination
+from dcim.models import CableTermination, PathEndpoint
 from extras.models import ChangeLoggedModel, CustomFieldModel, ObjectChange, TaggedItem
 from extras.utils import extras_features
 from utilities.querysets import RestrictedQuerySet
@@ -232,7 +232,7 @@ class Circuit(ChangeLoggedModel, CustomFieldModel):
         return self._get_termination('Z')
 
 
-class CircuitTermination(CableTermination):
+class CircuitTermination(PathEndpoint, CableTermination):
     circuit = models.ForeignKey(
         to='circuits.Circuit',
         on_delete=models.CASCADE,

+ 1 - 0
netbox/dcim/management/commands/retrace_paths.py

@@ -12,6 +12,7 @@ ENDPOINT_MODELS = (
     'dcim.ConsolePort',
     'dcim.ConsoleServerPort',
     'dcim.Interface',
+    'dcim.PowerFeed',
     'dcim.PowerOutlet',
     'dcim.PowerPort',
 )

+ 2 - 2
netbox/dcim/models/power.py

@@ -10,7 +10,7 @@ from extras.models import ChangeLoggedModel, CustomFieldModel, TaggedItem
 from extras.utils import extras_features
 from utilities.querysets import RestrictedQuerySet
 from utilities.validators import ExclusionValidator
-from .device_components import CableTermination
+from .device_components import CableTermination, PathEndpoint
 
 __all__ = (
     'PowerFeed',
@@ -73,7 +73,7 @@ class PowerPanel(ChangeLoggedModel, CustomFieldModel):
 
 
 @extras_features('custom_fields', 'custom_links', 'export_templates', 'webhooks')
-class PowerFeed(ChangeLoggedModel, CableTermination, CustomFieldModel):
+class PowerFeed(ChangeLoggedModel, PathEndpoint, CableTermination, CustomFieldModel):
     """
     An electrical circuit delivered from a PowerPanel.
     """