1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #11670: Add ability to optionally import DeviceType and ModuleType weight (#12512)

* 11670: Add optional weight to DeviceType import

This is 1 of 2 commits to address issue #11670

To maintain consistency, the import design of the DeviceType weight follows the
same pattern used for importing weight and weight units in DCIM Racks.

* Closes #11670: Add weight to ModuleType import

This is commit 2 of 2 to address and close #11670.

To maintain consistency, the import design of the ModuleType weight follows the
same pattern used for importing weight and weight units in DCIM Racks.

* Merge tests; misc cleanup

---------

Co-authored-by: jeremystretch <jstretch@netboxlabs.com>
This commit is contained in:
Dillon Henschen
2023-05-09 09:59:42 -04:00
committed by GitHub
parent e1b7a3aeb6
commit c55c14ea4c
3 changed files with 45 additions and 5 deletions

View File

@@ -184,6 +184,8 @@ class DeviceType(PrimaryModel, WeightMixin):
'subdevice_role': self.subdevice_role,
'airflow': self.airflow,
'comments': self.comments,
'weight': float(self.weight) if self.weight is not None else None,
'weight_unit': self.weight_unit,
}
# Component templates
@@ -361,6 +363,8 @@ class ModuleType(PrimaryModel, WeightMixin):
'model': self.model,
'part_number': self.part_number,
'comments': self.comments,
'weight': float(self.weight) if self.weight is not None else None,
'weight_unit': self.weight_unit,
}
# Component templates