Skip to content
Advertisement

Model hierarchy in Django [closed]

Sorry for the long text

Models are given:

  1. User

  2. Hierarchy

    class Hierarchy (Model):

There are users, they can invite each other. The invitees, in turn, can accept the invite or reject it.

Suppose that Mark invited Masha, Katya and Dima. Masha accepted Mark’s invitation, and even invited Kolya herself.

On one tab, you need to display the hierarchy.

Continuing the example, Mark should have:

And so on.

Tell me how to implement it | what to familiarize yourself with to get closer to the result

Advertisement

Answer

As far as I understand, you want a tree, not a graph. In such cases To minimize database queries you need to modernize your hierarchy model

  • Get your list
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement