DEV Community

amrshedou
amrshedou

Posted on

2 1

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...

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more