django-tastypie: Posting to a Resource having ManytoMany field with through relationship

后端 未结 3 1521
既然无缘
既然无缘 2021-01-05 20:10

I\'m working on a API for a project and I have a relationship Order/Products through OrderProducts like this:

In models.py

class Product(models.Model         


        
3条回答
  •  粉色の甜心
    2021-01-05 20:38

    The solution lies in overriding the save_m2m() method on the resource. In my case I needed the manytomany field for only listing, so overridden the save_m2m() method to do nothing.

提交回复
热议问题