diff --git a/src/django_pint_field/forms.py b/src/django_pint_field/forms.py index b6efdd0..ded0a2f 100644 --- a/src/django_pint_field/forms.py +++ b/src/django_pint_field/forms.py @@ -304,7 +304,7 @@ def to_python(self, value) -> Optional[Quantity]: if hasattr(quantity, "magnitude") and isinstance(quantity.magnitude, Decimal): validate_decimal_precision(quantity) - else: + elif quantity is not None: try: quantity = self.ureg.Quantity(quantity) except Exception as e: