Created
March 19, 2019 09:27
-
-
Save Toshakins/698b1ae2b58e390f69d55b1b6b5df7d9 to your computer and use it in GitHub Desktop.
DRF Nested Multipart Example
This file contains 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
class NestedSerializer(Serializer): | |
name = CharField() | |
... | |
class UserSerializer(Serializer): | |
user = JSONField(validators=nested_validator) | |
... | |
def nested_validator(value): | |
serializer = NestedSerializer(data=value) | |
serializer.is_valid(raise_exception=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment