mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Cleanup for #9654
This commit is contained in:
parent
0bcc59a1e9
commit
87fd09ca8b
@ -384,13 +384,10 @@ class DeviceTypeForm(NetBoxModelForm):
|
|||||||
comments = CommentField()
|
comments = CommentField()
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('Device Type', (
|
('Device Type', ('manufacturer', 'model', 'slug', 'description', 'tags')),
|
||||||
'manufacturer', 'model', 'slug', 'description', 'tags',
|
|
||||||
)),
|
|
||||||
('Chassis', (
|
('Chassis', (
|
||||||
'u_height', 'is_full_depth', 'part_number', 'subdevice_role', 'airflow',
|
'u_height', 'is_full_depth', 'part_number', 'subdevice_role', 'airflow', 'weight', 'weight_unit',
|
||||||
)),
|
)),
|
||||||
('Attributes', ('weight', 'weight_unit')),
|
|
||||||
('Images', ('front_image', 'rear_image')),
|
('Images', ('front_image', 'rear_image')),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -171,7 +171,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Total Weight</th>
|
<th scope="row">Total Weight</th>
|
||||||
<td>{{ object.total_weight|floatformat }} Kilograms</td>
|
<td>
|
||||||
|
{{ object.total_weight|floatformat }} Kilograms
|
||||||
|
({{ object.total_weight|kg_to_pounds|floatformat }} Pounds)
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,17 +56,20 @@
|
|||||||
<div class="form-text">Unit</div>
|
<div class="form-text">Unit</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row mb-3">
|
||||||
|
<label class="col col-md-3 col-form-label text-lg-end">Weight</label>
|
||||||
|
<div class="col col-md-6 mb-1">
|
||||||
|
{{ form.weight }}
|
||||||
|
<div class="form-text">Weight</div>
|
||||||
|
</div>
|
||||||
|
<div class="col col-md-3 mb-1">
|
||||||
|
{{ form.weight_unit }}
|
||||||
|
<div class="form-text">Unit</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% render_field form.mounting_depth %}
|
{% render_field form.mounting_depth %}
|
||||||
{% render_field form.desc_units %}
|
{% render_field form.desc_units %}
|
||||||
</div>
|
</div>
|
||||||
<div class="field-group my-5">
|
|
||||||
<div class="row mb-2">
|
|
||||||
<h5 class="offset-sm-3">Weight</h5>
|
|
||||||
</div>
|
|
||||||
{% render_field form.weight %}
|
|
||||||
{% render_field form.weight_unit %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{% if form.custom_fields %}
|
{% if form.custom_fields %}
|
||||||
<div class="field-group my-5">
|
<div class="field-group my-5">
|
||||||
|
@ -171,6 +171,14 @@ def meters_to_feet(n):
|
|||||||
return float(n) * 3.28084
|
return float(n) * 3.28084
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter()
|
||||||
|
def kg_to_pounds(n):
|
||||||
|
"""
|
||||||
|
Convert a weight from kilograms to pounds.
|
||||||
|
"""
|
||||||
|
return float(n) * 2.204623
|
||||||
|
|
||||||
|
|
||||||
@register.filter("startswith")
|
@register.filter("startswith")
|
||||||
def startswith(text: str, starts: str) -> bool:
|
def startswith(text: str, starts: str) -> bool:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user