The `.create()` method does not support writable nested fields by default.

后端 未结 3 446
陌清茗
陌清茗 2020-12-06 01:49

I have a big problem regarding the serialization of a Many to Many relationship with intermediate model in DRF: If the request method is get everything works perfectly. But

3条回答
  •  情书的邮戳
    2020-12-06 02:14

    Maybe for most people who is having the same issue, this question is a quite long.

    The short answer is that DRF does not support natively create method for nested serializers. so what to do?

    Simply overriding the default behaviour. Check out a full example in the Official DRF docs

提交回复
热议问题