I'm not really sure if it's DRF of Django issue. It seems that input should (?) be modified for DecimalField before it ends up at .validated_data. Otherwise one can pass an int and retured object from .save() would be a incorrect.
obj.price would be (Decimal) 100 and not (Decimal) 100.00, however serializer.data['price'] would be correctly formatted: (Decimal) 100.00; It's confusing and forces users to do obj.refresh_from_db() if one wants to use returned object and not serializer.data in their code.
The text was updated successfully, but these errors were encountered:
I'm not really sure if it's DRF of Django issue. It seems that input should (?) be modified for DecimalField before it ends up at
.validated_data
. Otherwise one can pass anint
and retured object from.save()
would be a incorrect.Code:
obj.price
would be(Decimal) 100
and not(Decimal) 100.00
, howeverserializer.data['price']
would be correctly formatted:(Decimal) 100.00
; It's confusing and forces users to doobj.refresh_from_db()
if one wants to use returned object and notserializer.data
in their code.The text was updated successfully, but these errors were encountered: