9654 device weight (#10448)

* 9654 add weight fields to devices

* 9654 changes from code review

* 9654 change _abs_weight to grams

* Resolve migrations conflict

* 9654 code-review changes

* 9654 total weight on devices

* Misc cleanup

Co-authored-by: Jeremy Stretch <jstretch@ns1.com>
This commit is contained in:
Arthur Hanson
2022-09-30 13:31:04 -07:00
committed by GitHub
parent af8bb0c4b9
commit 204c10c053
24 changed files with 397 additions and 57 deletions

View File

@@ -35,6 +35,16 @@
<td>Full Depth</td>
<td>{% checkmark object.is_full_depth %}</td>
</tr>
<tr>
<td>Weight</td>
<td>
{% if object.weight %}
{{ object.weight|floatformat }} {{ object.get_weight_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<td>Parent/Child</td>
<td>

View File

@@ -22,6 +22,16 @@
<td>Part Number</td>
<td>{{ object.part_number|placeholder }}</td>
</tr>
<tr>
<td>Weight</td>
<td>
{% if object.weight %}
{{ object.weight|floatformat }} {{ object.get_weight_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<td>Instances</td>
<td><a href="{% url 'dcim:module_list' %}?module_type_id={{ object.pk }}">{{ instance_count }}</a></td>

View File

@@ -104,9 +104,7 @@
</div>
</div>
<div class="card">
<h5 class="card-header">
Dimensions
</h5>
<h5 class="card-header">Dimensions</h5>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
@@ -147,6 +145,20 @@
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Rack Weight</th>
<td>
{% if object.weight %}
{{ object.weight|floatformat }} {{ object.get_weight_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">Total Weight</th>
<td>{{ object.total_weight|floatformat }} Kilograms</td>
</tr>
</table>
</div>
</div>
@@ -186,6 +198,7 @@
</div>
</div>
{% endif %}
{% include 'inc/panels/image_attachments.html' %}
<div class="card">
<h5 class="card-header">

View File

@@ -57,6 +57,14 @@
</div>
{% render_field form.desc_units %}
</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 %}
<div class="field-group my-5">