Set many=True in get_serializer if data is list #8026
Unanswered
nico-deforge
asked this question in
Ideas & Suggestions
Replies: 1 comment
-
Is my proposal a bad idea ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone,
Thank you for this top library, I use it everyday.
When we want to deserialize list of object, I would like to set many=True in the get_serializer methof of the viewset.
Today, i override the method and i do this :
def get_serializer(self, *args, **kwargs): if isinstance(kwargs.get("data", {}), list): kwargs["many"] = True return super().get_serializer(*args, **kwargs)
Does this feature should be standard ?
Thank you for your response,
Nicolas
Beta Was this translation helpful? Give feedback.
All reactions