You can pass in the name of a model as a string to ForeignKey and it will do the right thing.
parent = models.ForeignKey("Comment")
Or you can use the string "self"
parent = models.ForeignKey("self")
So the model will be as bellow -
class Comment(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
blog = models.ForeignKey(Blog, on_delete=models.CASCADE)
details = models.TextField()
parent = models.ForeignKey('self', null=True, blank=True, default=0, on_delete=models.CASCADE)
Tags
Django