Skip to content

Conversation

@juannyG
Copy link
Contributor

@juannyG juannyG commented Jul 3, 2015

After reviewing #2796, #2719, and #2919, I thought it might not hurt to propose a fix for the simpler use case where mulitpart data for nested serializers with required=False fails validation when the field is not present.

I agree that great care is needed regarding the design decisions still needed on how the data in a serializer's "validated_data" property should be constructed (and that it should be consistent and predictable), but the fact still remains that currently, you cannot use a View with a serializer that defines a nested serializer with required=False.

I'm hoping this fix can make it into the core, so the format/structure/construction of a serializer's "validated_data" properly can be handled as separate issue.

@xordoquy xordoquy added this to the 3.1.4 Release milestone Jul 8, 2015
@xordoquy
Copy link
Contributor

xordoquy commented Jul 8, 2015

Thanks for the PR.
Why do you define FakeMultiDict ? I mean, Is there a reason Django's QueryDict can't be used here ?

@juannyG
Copy link
Contributor Author

juannyG commented Jul 8, 2015

Hey @xordoquy - thanks for the feedback!

The short answer to your question - nope! The QueryDict satisfies what I'm trying to do in the FakeMultiDict definition. I've updated the PR to use QueryDict.

The longer answer is I was piggy-backing off of #2796 - but simply in order to show that these two PRs are related, but not duplicates - I'm trying to solve for a smaller use case. That said, based on your comment, it seems to me that #2796 could ALSO use QueryDict, but we can tackle that separately :-)

@xordoquy
Copy link
Contributor

xordoquy commented Jul 8, 2015

@juannyG thanks, comment added in #2796 ;)

@xordoquy
Copy link
Contributor

xordoquy commented Jul 8, 2015

Ok, looks good to me, thanks for the quick fixes !

xordoquy added a commit that referenced this pull request Jul 8, 2015
Fix nested serializer required=False multipart data validation bug
@xordoquy xordoquy merged commit f33ca01 into encode:master Jul 8, 2015
@lovelydinosaur lovelydinosaur modified the milestones: 3.1.4 Release, 3.2.0 Release Jul 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants