Django self-referential foreign key
You can pass in the name of a model as a string to ForeignKey and it will do the right thing.
So:
parent = models.ForeignKey("CategoryModel")
Or you can use the string "self"
parent = models.ForeignKey("self")
You can use the string 'self' to indicate a self-reference.
class CategoryModel(models.Model):
parent = models.ForeignKey('self')
https://docs.djangoproject.com/en/dev/ref/models/fields/#foreignkey