Not required DecimalField in nested Serializer gives error on empty input in browsable API #7746
Replies: 3 comments
-
Probably worth including a screenshot of the browsable API form behavior for tickets like this. The browsable API isn't yet intended to support nested fields in forms, so you should be using the raw content input box, but let's take a quick look at this all the same - see if we can make any improvements. |
Beta Was this translation helpful? Give feedback.
-
Good point, here is a screenshot: Doing some research lead me to believe the behaviour comes from |
Beta Was this translation helpful? Give feedback.
-
Thanks @jgadelange. |
Beta Was this translation helpful? Give feedback.
-
I have a nested serializer with a
DecimalField(required=False)
. Implemented something like stated below:When I now use the browsable API I get a form as expected (a main field, sub field and a header for the Sub serializer). When I leave both inputs empty, I will only get an error for
sub_field
saying:A valid number is required.
not formain_field
.Beta Was this translation helpful? Give feedback.
All reactions