From f769f773f1bbfdcebc2d15e79f233ba3e6a829c1 Mon Sep 17 00:00:00 2001 From: Brian Tiemann Date: Mon, 23 Sep 2024 14:31:06 -0400 Subject: [PATCH] Respect the weight unit of the DeviceType when displaying the Device details --- netbox/templates/dcim/device.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index b74d4b5f6..867c70c8b 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -324,7 +324,11 @@ {% trans "Weight" %} {% if object.total_weight %} - {{ object.total_weight|floatformat }} {% trans "Kilograms" %} + {% if object.device_type.weight_unit == "lb" %} + {{ object.total_weight|kg_to_pounds|floatformat }} {% trans "Pounds" %} + {% elif object.device_type.weight_unit == "kg" %} + {{ object.total_weight|floatformat }} {% trans "Kilograms" %} + {% endif %} {% else %} {{ ''|placeholder }} {% endif %}