Skip to content

Instantly share code, notes, and snippets.

@azpwnz
Created May 14, 2017 18:30
Show Gist options
  • Save azpwnz/9ede96e230d62511a04531519c4c1fef to your computer and use it in GitHub Desktop.
Save azpwnz/9ede96e230d62511a04531519c4c1fef to your computer and use it in GitHub Desktop.
Add non-model fields back to validated_data by overwriting the to_internal_value function. Then it will be available in update/create methods
def to_internal_value(self, data):
internal_value = super(SearchPresetSerializer, self).to_internal_value(data)
user = data.get("user")
internal_value.update({
"user": user
})
return internal_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment