'Django - multi-level table challenge

I'm new to Django, but an older programmer ;o)

I've managed to create a functionally working site that has 5 tables. Where each one is a 1-to-M relationship to the one below it. Also created the breadcrumb at the top of each page. I'm using htmx to allow interaction with the 0 to many records under the parent record directly above.

Two challenges, how to traverse all 5 tables to

  1. Display all data for a given A record and/or create a report for a given A record and
  2. Create a navigation sidebar or similar for the first 3 levels to provide visibility of what entries you've got

Example of potential structure

-> A
  -> B
    -> C
      -> D
        -> E
      -> D
        -> E
  -> B
    -> C
      -> D
        -> E
        -> E
      -> D
        -> E

looking for some thoughts or any pointers to examples



Solution 1:[1]

Kind of solved my own question. I created database views with unmanaged models in Django. These views are used for various "reports" across the hierarchy. One report is called all_items and when displaying via django template have the values as clickable links to goto the appropriate list/edit pages. This way achieve the aim of providing full visibility of data entered.

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 Beany386