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

This commit is contained in:
Brian Tiemann 2024-09-23 14:31:06 -04:00
parent 6b219a279b
commit f769f773f1

View File

@ -324,7 +324,11 @@
<th scope="row">{% trans "Weight" %}</th> <th scope="row">{% trans "Weight" %}</th>
<td> <td>
{% if object.total_weight %} {% if object.total_weight %}
{% 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" %} {{ object.total_weight|floatformat }} {% trans "Kilograms" %}
{% endif %}
{% else %} {% else %}
{{ ''|placeholder }} {{ ''|placeholder }}
{% endif %} {% endif %}