DEV Community

Vicente G. Reyes
Vicente G. Reyes

Posted on

DRF ManyToMany Field getting an error when creating object

I have a Rant model with Category linked to it using ManyToManyField. I've serialized it but the problem is this error:

{
  "categories": [
    "Expected a list of items but got type \"str\"."
  ]
}

These are my serializers:

class CategorySerializer(serializers.ModelSerializer)
    class Meta:
        model = Category
        fields = "__all__"

Top comments (2)

Collapse
 
chilusoft profile image
Chilusoft • Edited

Checkout my answer to your issue here

Collapse
 
highcenburg profile image
Vicente G. Reyes

Got it man! Thank you! It worked!

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more