Type error to create and update my list in django rest framework

后端 未结 3 1861
悲哀的现实
悲哀的现实 2021-01-17 01:57

I\'m trying to use my api to create and update products in a bundle. I did so:

model.py

class Business(models.Model):
    name = models.CharField(max         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-17 02:40

    In my experience, if you want to update a model and a related model in one request, with DRF, the easiest way to do this is to override the "create" method of a serializer. There's a good video on this here which I used as my reference: https://www.youtube.com/watch?v=EyMFf9O6E60

提交回复
热议问题