How to remove an object from ManyToMany relationship in Django Rest Framework
<p>I have a model with ManyToMany relationship.</p>

<pre><code>class File(models.Model):
    name = models.CharField(max_length=64)

    def __str__(self):
        return self.name


class Folder(models.Model):
    name = models.CharField(max_length=64)
    files = models.ManyToManyField(File, related_name='folders', default=None)

    def __str__(self):
        return self.name
</code></pre>

<p>Serializers:</p>

<pre><code>class FileSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.File
        fields = '__all__'


class FolderSerializer(serializers.ModelSerializer):
    files = FileSerializer(many=True, read_only=True)
    file = serializers.PrimaryKeyRelatedField(queryset=models.File.objects.all(),
                                          write_only=True, label='File Name')

    class Meta:
        model = models.Folder
        fields = ('id', 'name', 'files', 'file')
</code></pre>

<p>I am able to add a file object to the folder. I am able to update the name of the folder too. But how do I remove a file object from the folder?</p>