1👍
✅
The answer you seek is not just operation with django model, that has a FK to itself. Seems like you need to implement some tree, which is not an easy technical task. Depending on your requirements such as desired performance, etc, you may want to implement your own solution or use already implemented ones. There was a goto solution before called django mptt, but seems like it’s abandoned. Regardless on their github page(https://github.com/django-mptt/django-mptt) they have useful links. This post will be good starting point for you to go – https://406.ch/writing/django-tree-queries/
Source:stackexchange.com