serializer default value missing in nested Serializer #7825
Unanswered
Kurara
asked this question in
Potential Issue
Replies: 1 comment 1 reply
-
This looks a bit too convoluted for me to be able to dig into / help with. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version:
Django==3.0.6
djangorestframework==3.11.0
I don't know if it's fixed in master becuase I can't upgrade all my project just to test this
Steps to reproduce
I create a serializer with a default:
I used it in other serializer as a list:
Expected behavior
In the save of the MainSerilizer, I'm custom saving the metadata as it's a list. When I'm in POST I find the
_metadata0.get('type')
filled with 'string' but in PATCH no.For you information, this to_many_objects is filled here:
So it comes from
validated_data
Seems in POST validated_data has the default, but in PATCH no.Actual behavior
_metadata0.get('type')
is not filled with 'string' in PATCHI fixed it in my project just by doing:
_metadata0.get('type', 'string')
but I think this should be reported as I don't think is a correct way to behave for the framework.Beta Was this translation helpful? Give feedback.
All reactions