DRF ManyToMany Field getting an error when creating object

Vicente G. Reyes - Apr 2 '23 - - Dev Community

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__"
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player