File tree Expand file tree Collapse file tree 4 files changed +8
-4
lines changed Expand file tree Collapse file tree 4 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 99from django .conf import settings
1010from django .core .exceptions import FieldError
1111from django .db .models import Q
12+ from django .template .defaultfilters import floatformat
1213from django .urls import reverse
1314from django .utils .http import urlencode
1415
@@ -41,7 +42,7 @@ def get_device_description(device):
4142 device .device_role ,
4243 device .device_type .manufacturer .name ,
4344 device .device_type .model ,
44- device .device_type .u_height ,
45+ floatformat ( device .device_type .u_height ) ,
4546 device .asset_tag or '' ,
4647 device .serial or ''
4748 )
Original file line number Diff line number Diff line change @@ -85,6 +85,9 @@ class DeviceTypeTable(NetBoxTable):
8585 tags = columns .TagColumn (
8686 url_name = 'dcim:devicetype_list'
8787 )
88+ u_height = columns .TemplateColumn (
89+ template_code = '{{ value|floatformat }}'
90+ )
8891
8992 class Meta (NetBoxTable .Meta ):
9093 model = DeviceType
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ <h5 class="card-header">
6666 {% with object.parent_bay.device as parent %}
6767 {{ parent|linkify }} / {{ object.parent_bay }}
6868 {% if parent.position %}
69- (U{{ parent.position }} / {{ parent.get_face_display }})
69+ (U{{ parent.position|floatformat }} / {{ parent.get_face_display }})
7070 {% endif %}
7171 {% endwith %}
7272 {% elif object.rack and object.position %}
@@ -90,7 +90,7 @@ <h5 class="card-header">
9090 < tr >
9191 < th scope ="row "> Device Type</ th >
9292 < td >
93- {{ object.device_type|linkify:"get_full_name" }} ({{ object.device_type.u_height }}U)
93+ {{ object.device_type|linkify:"get_full_name" }} ({{ object.device_type.u_height|floatformat }}U)
9494 </ td >
9595 </ tr >
9696 < tr >
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ <h5 class="card-header">
2929 </ tr >
3030 < tr >
3131 < td > Height (U)</ td >
32- < td > {{ object.u_height }}</ td >
32+ < td > {{ object.u_height|floatformat }}</ td >
3333 </ tr >
3434 < tr >
3535 < td > Full Depth</ td >
You can’t perform that action at this time.
0 commit comments