How to post when using StringRelatedField?

class Comment(models.Model):
    text = models.TextField()
    owner = models.CharField(max_length=100)
    reply = models.ForeignKey(
        'self', null=True, on_delete=models.CASCADE)

    def __str__(self):
        return '%s' % (self.owner)

class CommentSerializer(serializers.ModelSerializer):
    reply = serializers.StringRelatedField()

    class Meta:
        model = Comment
        fields = ['id', 'reply', 'text', 'owner']

I have implemented Foreign key to fetch a reply for Comment using StringRelatedField in DRF. This however does not work while POST.Can anyone help me?

Quoting directly from the docs for StringRelatedField.

This field is read only.

If you’re going to post to Comment, you would need to either provide the pk of the Comment object to which you refer, or include your own transformation to change the reference you do have to an appropriate object reference.

Also note that this forum is not one of the officially-recognized locations for getting help on DRF as identified in the docs at Support. You may be able to get more detailed or specific assistance at one of those locations.