Non-obvious behavior of validated_data when using serializer with MultiPartParser. #8229
Unanswered
blohinn
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Look at my simple test case:
I create request with multipart/form-data content and specify 4 fields: name, slug, bed (file) and cov (file).
Then i create a drf-like request object and as a parser i specify MultiPartParser.
Then i pass request data to serializer two different ways:
Look at validated_data now:
1)
Why so unobvious behavior? I pass only 4 fields.
For example, i'am waiting that my zond, ampl, germ, somat fields will be True after creating instance because a have default=True in model fields for this.
I think behavior №2 is more obvious, but default behavior is №1.
As far as I know, JSONParser is more obvious and doesn't try to do more than it needs to.
Beta Was this translation helpful? Give feedback.
All reactions