mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-15 11:35:41 +00:00
Catch potential error when posting invalid numbers via REST API
This commit is contained in:
@ -328,4 +328,7 @@ class InvenTreeDecimalField(serializers.FloatField):
|
|||||||
def to_internal_value(self, data):
|
def to_internal_value(self, data):
|
||||||
|
|
||||||
# Convert the value to a string, and then a decimal
|
# Convert the value to a string, and then a decimal
|
||||||
return Decimal(str(data))
|
try:
|
||||||
|
return Decimal(str(data))
|
||||||
|
except:
|
||||||
|
raise serializers.ValidationError(_("Invalid value"))
|
||||||
|
Reference in New Issue
Block a user