mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* 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:
@@ -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
|
||||
|
Reference in New Issue
Block a user