How can i bulk create in django rest serializer

后端 未结 1 1460
南方客
南方客 2020-12-20 15:17

I used to use allow_add_remove=True which was availabe in django rest 2.0 for writing nestable serializer but its not available in 3.0 and i am having hard

相关标签:
1条回答
  • 2020-12-20 15:45

    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

    0 讨论(0)
提交回复
热议问题