diff --git a/netbox/dcim/models/mixins.py b/netbox/dcim/models/mixins.py index d4a05699c..4f38bebea 100644 --- a/netbox/dcim/models/mixins.py +++ b/netbox/dcim/models/mixins.py @@ -37,7 +37,7 @@ class WeightMixin(models.Model): # Store the given weight (if any) in grams for use in database ordering if self.weight and self.weight_unit: - self._abs_weight = to_grams(self.weight, self.weight_unit) + self._abs_weight = int(to_grams(self.weight, self.weight_unit)) else: self._abs_weight = None diff --git a/netbox/utilities/conversion.py b/netbox/utilities/conversion.py index cd75c3c17..be95df14f 100644 --- a/netbox/utilities/conversion.py +++ b/netbox/utilities/conversion.py @@ -10,7 +10,7 @@ __all__ = ( ) -def to_grams(weight, unit): +def to_grams(weight, unit) -> float: """ Convert the given weight to kilograms. """