New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tweaks to writable nested serializers #739
tweaks to writable nested serializers #739
Conversation
@@ -360,7 +360,9 @@ def field_from_native(self, data, files, field_name, into): | |||
except KeyError: | |||
if self.required: | |||
raise ValidationError(self.error_messages['required']) | |||
return | |||
if self.default is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably mirror the WritableField style:
if self.default is not None and not self.partial:
# Note: partial updates shouldn't set defaults
value = copy.deepcopy(self.default)
else:
if self.required:
raise ValidationError(self.error_messages['required'])
return
LGTM. I'll let @tomchristie handle merging it in if he wants. |
Also, have you done much testing with this branch? I'd be interested to get some feedback on real world usage. |
@maspwr We're not using the branch in production yet, just on my dev VM. It's going to be an export API for http://koordinates.com . Basically you can create a download of some spatial data by posting to the API. A typical post might look something like https://gist.github.com/craigds/15a5aeffe3e831018547 |
OK, cool. Looks like pretty typical usage. Let us know if you run into any issues. Thanks for the info! |
tweaks to writable nested serializers
allows required and default kwargs in field constructor for serializers.