The Python Oracle

How can i bulk create in django rest serializer

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: A Thousand Exotic Places Looping v001

--

Chapters
00:00 Question
01:15 Accepted answer (Score 8)
01:52 Thank you

--

Full question
https://stackoverflow.com/questions/3382...

Accepted answer links:
[documentation provides an example]: http://www.django-rest-framework.org/api...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #django #djangorestframework

#avk47



ACCEPTED ANSWER

Score 11


Yes you do need to override create and update methods of your UserSerializer.

I've spent a lot of time trying to make nested writable serializers work with DRF 2.x and the more I fixed issues the more issues were risen with corner use cases.

Therefore Tom decided that it should be left up to the developer to handle the creation and updates.

The documentation provides an example for a 1 nesting level creation but it's the same for update and/or with more nesting level