'Django retrieve data from multiple tables on 2 levels

enter image description here

I have this condition where for each value of table A, I need to recover the values of all connected tables, first (blue tables) and second level (green tables). As far as possible, I would like to adopt a simple solution, which follows Django's directives and doing well, which I obviously have not found. As from suggestions found online, for each foreign key I also set a 'Related Name', even if I am not sure it is useful for the purpose.

Python: 3.7 Django: 3.12



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source