Created
May 14, 2017 18:30
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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