mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 00:15:17 -06:00
9654 add weight fields to devices
This commit is contained in:
parent
15ad2ab8d2
commit
e21f4854b8
@ -285,15 +285,26 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
|
||||
widget=SmallTextarea,
|
||||
label='Comments'
|
||||
)
|
||||
weight = forms.DecimalField(
|
||||
min_value=0,
|
||||
required=False
|
||||
)
|
||||
weight_unit = forms.ChoiceField(
|
||||
choices=add_blank_choice(DeviceWeightUnitChoices),
|
||||
required=False,
|
||||
initial='',
|
||||
widget=StaticSelect()
|
||||
)
|
||||
|
||||
model = Rack
|
||||
fieldsets = (
|
||||
('Rack', ('status', 'role', 'tenant', 'serial', 'asset_tag')),
|
||||
('Location', ('region', 'site_group', 'site', 'location')),
|
||||
('Hardware', ('type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit')),
|
||||
('Attributes', ('weight', 'weight_unit')),
|
||||
)
|
||||
nullable_fields = (
|
||||
'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'comments',
|
||||
'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'comments', 'weight'
|
||||
)
|
||||
|
||||
|
||||
|
@ -260,7 +260,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
|
||||
fields = [
|
||||
'region', 'site_group', 'site', 'location', 'name', 'facility_id', 'tenant_group', 'tenant', 'status',
|
||||
'role', 'serial', 'asset_tag', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth',
|
||||
'outer_unit', 'comments', 'tags',
|
||||
'outer_unit', 'comments', 'tags', 'weight', 'weight_unit'
|
||||
]
|
||||
help_texts = {
|
||||
'site': "The site at which the rack exists",
|
||||
@ -273,6 +273,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
|
||||
'type': StaticSelect(),
|
||||
'width': StaticSelect(),
|
||||
'outer_unit': StaticSelect(),
|
||||
'weight_unit': StaticSelect(),
|
||||
}
|
||||
|
||||
|
||||
|
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user