mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 11:56:25 -06:00
Coerce _abs_weight to int to prevent disagreement with PositiveBigIntegerField deserialization
This commit is contained in:
parent
0ff0edd477
commit
634634d65b
@ -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
|
||||
|
||||
|
@ -10,7 +10,7 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
def to_grams(weight, unit):
|
||||
def to_grams(weight, unit) -> float:
|
||||
"""
|
||||
Convert the given weight to kilograms.
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user