mutually referential manytoone relationships strings can be used instead of model literals to set up lazy relations use a simple string for forward declarations you can also explicitly specify the related app use a simple string for forward declarations you can also explicitly specify the related app
from django.db import models


class Parent(models.Model):
    name = models.CharField(max_length=100)

    
    bestchild = models.ForeignKey(
        "Child", models.SET_NULL, null=True, related_name="favored_by"
    )


class Child(models.Model):
    name = models.CharField(max_length=100)

    
    parent = models.ForeignKey("mutually_referential.Parent", models.CASCADE)