diff --git a/CHANGELOG.md b/CHANGELOG.md index 19b3089f2..042649676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ v2.6.0 (FUTURE) ## Bug Fixes (From Beta) * [#3123](https://github.com/digitalocean/netbox/issues/3123) - Exempt `/metrics` view from authentication +* [#3125](https://github.com/digitalocean/netbox/issues/3125) - Fix exception when viewing PDUs --- diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 76db26c29..d6aa43853 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -1956,8 +1956,8 @@ class PowerPort(CableTermination, ComponentModel): outlet_ids = PowerOutlet.objects.filter(power_port=self).values_list('pk', flat=True) utilization = PowerPort.objects.filter(_connected_poweroutlet_id__in=outlet_ids).aggregate( - maximum_draw=Sum('maximum_draw'), - allocated_draw=Sum('allocated_draw'), + maximum_draw_total=Sum('maximum_draw'), + allocated_draw_total=Sum('allocated_draw'), ) utilization['outlets'] = len(outlet_ids) utilization['available_power'] = powerfeed_available @@ -1968,8 +1968,8 @@ class PowerPort(CableTermination, ComponentModel): for leg, leg_name in POWERFEED_LEG_CHOICES: outlet_ids = PowerOutlet.objects.filter(power_port=self, feed_leg=leg).values_list('pk', flat=True) utilization = PowerPort.objects.filter(_connected_poweroutlet_id__in=outlet_ids).aggregate( - maximum_draw=Sum('maximum_draw'), - allocated_draw=Sum('allocated_draw'), + maximum_draw_total=Sum('maximum_draw'), + allocated_draw_total=Sum('allocated_draw'), ) utilization['name'] = 'Leg {}'.format(leg_name) utilization['outlets'] = len(outlet_ids) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index c82f795b5..710ea2a7f 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -934,7 +934,7 @@ class DeviceView(PermissionRequiredMixin, View): power_ports = device.powerports.select_related('_connected_poweroutlet__device', 'cable') # Power outlets - poweroutlets = device.poweroutlets.select_related('connected_endpoint__device', 'cable') + poweroutlets = device.poweroutlets.select_related('connected_endpoint__device', 'cable', 'power_port') # Interfaces interfaces = device.vc_interfaces.select_related( diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index 72b5f6b02..ca41514ca 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -361,7 +361,7 @@ {{ pp }} {% endif %} {{ leg.outlets|placeholder }} - {{ leg.allocated_draw }} / {{ leg.maximum_draw }} + {{ leg.allocated_draw_total }} / {{ leg.maximum_draw_total }} {{ leg.available_power }} {% endfor %}