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

11048 fix connected_endpoint refs

Arthur 3 лет назад
Родитель
Сommit
cf0258204f

+ 2 - 2
docs/customization/reports.md

@@ -45,7 +45,7 @@ class DeviceConnectionsReport(Report):
         # Check that every console port for every active device has a connection defined.
         active = DeviceStatusChoices.STATUS_ACTIVE
         for console_port in ConsolePort.objects.prefetch_related('device').filter(device__status=active):
-            if console_port.connected_endpoint is None:
+            if not console_port.connected_endpoints:
                 self.log_failure(
                     console_port.device,
                     "No console connection defined for {}".format(console_port.name)
@@ -64,7 +64,7 @@ class DeviceConnectionsReport(Report):
         for device in Device.objects.filter(status=DeviceStatusChoices.STATUS_ACTIVE):
             connected_ports = 0
             for power_port in PowerPort.objects.filter(device=device):
-                if power_port.connected_endpoint is not None:
+                if power_port.connected_endpoints:
                     connected_ports += 1
                     if not power_port.path.is_active:
                         self.log_warning(

+ 1 - 1
netbox/dcim/models/device_components.py

@@ -189,7 +189,7 @@ class PathEndpoint(models.Model):
     dcim.signals in response to changes in the cable path, and complements the `origin` GenericForeignKey field on the
     CablePath model. `_path` should not be accessed directly; rather, use the `path` property.
 
-    `connected_endpoint()` is a convenience method for returning the destination of the associated CablePath, if any.
+    `connected_endpoints()` is a convenience method for returning the destination of the associated CablePath, if any.
     """
     _path = models.ForeignKey(
         to='dcim.CablePath',

+ 1 - 1
netbox/templates/dcim/interface.html

@@ -210,7 +210,7 @@
         <div class="card">
           <h5 class="card-header">Wireless</h5>
           <div class="card-body">
-            {% with peer=object.connected_endpoint %}
+            {% with peer=object.connected_endpoints.0 %}
               <table class="table table-hover">
                 <thead>
                   <tr>

+ 1 - 1
netbox/templates/dcim/rack.html

@@ -173,7 +173,7 @@
                                 <td>{{ powerfeed|linkify }}</td>
                                 <td>{% badge powerfeed.get_status_display bg_color=powerfeed.get_status_color %}</td>
                                 <td>{% badge powerfeed.get_type_display bg_color=powerfeed.get_type_color %}</td>
-                                {% with power_port=powerfeed.connected_endpoint %}
+                                {% with power_port=powerfeed.connected_endpoints.0 %}
                                     {% if power_port %}
                                         <td>{% utilization_graph power_port.get_power_draw.allocated|percentage:powerfeed.available_power %}</td>
                                     {% else %}