Fixes: #17126 - Respect the weight unit of the DeviceType when displaying the Device detail (#17579)

* Respect the weight unit of the DeviceType when displaying the Device details

* Reuse the same weight formatting construct as in rack.html, and add placeholder in rack if empty
This commit is contained in:
bctiemann 2024-09-24 16:53:39 -04:00 committed by GitHub
parent 8420af8562
commit cfb5696d29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -325,6 +325,7 @@
<td>
{% if object.total_weight %}
{{ object.total_weight|floatformat }} {% trans "Kilograms" %}
({{ object.total_weight|kg_to_pounds|floatformat }} {% trans "Pounds" %})
{% else %}
{{ ''|placeholder }}
{% endif %}

View File

@ -103,8 +103,12 @@
<tr>
<th scope="row">{% trans "Total Weight" %}</th>
<td>
{{ object.total_weight|floatformat }} {% trans "Kilograms" %}
({{ object.total_weight|kg_to_pounds|floatformat }} {% trans "Pounds" %})
{% if object.total_weight %}
{{ object.total_weight|floatformat }} {% trans "Kilograms" %}
({{ object.total_weight|kg_to_pounds|floatformat }} {% trans "Pounds" %})
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
</table>