DEV Community

amrshedou
amrshedou

Posted on

Direct assignment to the reverse side of a many-to-many set is prohibited. Use products.set() instead. Django REST Framework

I'm getting this error
"Direct assignment to the reverse side of a many-to-many set is prohibited. Use products.set() instead"
when I'm trying to insert a field of a tree like structure of a model and don't know what to do ,for help and for more details please have a look at the stackoverflow Question
https://stackoverflow.com/questions/53419386/direct-assignment-to-the-reverse-side-of-a-many-to-many-set-is-prohibited-use-p

Top comments (1)

Collapse
 
rhymes profile image
rhymes

.set() requires a list of objects, check the documentation: docs.djangoproject.com/en/2.1/ref/...

This answer might also help you: stackoverflow.com/questions/500152...