I am looking for a good way to store and use hierarchical (parent / child) data in Django. I used django-mptt , but it seems completely incompatible with my brain - as a result, I get non-obvious errors in non-obvious places, mainly when moving things in a tree: I end up an inconsistent state where the node and its parent will not agree to their relationship.
My needs are simple:
- Given node:
- find your root
- find your ancestors
- find your descendants
- With a tree:
- easy to move nodes (i.e. change parent)
My trees will be small (no more than 10 thousand nodes of more than 20 levels, as a rule, much smaller, say, 10 nodes with 1 or 2 levels).
I should think that there should be an easier way to make trees in python / django. Are there other approaches that better help maintain consistency?
source
share