Coerce _abs_weight to int to prevent disagreement with PositiveBigIntegerField deserialization

This commit is contained in:
Brian Tiemann 2024-11-18 13:36:31 -05:00
parent 0ff0edd477
commit 634634d65b
2 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ class WeightMixin(models.Model):
# Store the given weight (if any) in grams for use in database ordering # Store the given weight (if any) in grams for use in database ordering
if self.weight and self.weight_unit: 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: else:
self._abs_weight = None self._abs_weight = None

View File

@ -10,7 +10,7 @@ __all__ = (
) )
def to_grams(weight, unit): def to_grams(weight, unit) -> float:
""" """
Convert the given weight to kilograms. Convert the given weight to kilograms.
""" """