[Answered ]-Django ManyToMany | TypeError: Direct assignment to the forward side of a many-to-many set is prohibited. Use course_tags.set() instead

1👍

Field is names course_tags so you should use this name when you fetch tags from validated data:

def create(self, validated_data):
    ...
    tags_data = validated_data.pop('course_tags', None)

Otherwise course_tags is still in validated_data and Course.objects.create() raises the error.

Leave a comment