django-fast-treenode 2.1.2__tar.gz → 2.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/MANIFEST.in +1 -0
  2. {django_fast_treenode-2.1.2/django_fast_treenode.egg-info → django_fast_treenode-2.1.4}/PKG-INFO +13 -5
  3. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/README.md +11 -4
  4. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4/django_fast_treenode.egg-info}/PKG-INFO +13 -5
  5. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/django_fast_treenode.egg-info/SOURCES.txt +1 -1
  6. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/django_fast_treenode.egg-info/requires.txt +1 -0
  7. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/about.md +19 -12
  8. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/admin.md +6 -2
  9. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/api.md +25 -20
  10. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/cache.md +7 -0
  11. django_fast_treenode-2.1.4/docs/index.md +95 -0
  12. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/migration.md +1 -1
  13. django_fast_treenode-2.1.4/docs/roadmap.md +63 -0
  14. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/pyproject.toml +4 -2
  15. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/setup.cfg +2 -1
  16. django_fast_treenode-2.1.2/treenode/tests/tests.py → django_fast_treenode-2.1.4/tests/test_suite.py +58 -50
  17. django_fast_treenode-2.1.4/treenode/cache.py +352 -0
  18. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/managers/adjacency.py +6 -4
  19. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/adjacency.py +40 -41
  20. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/closure.py +2 -23
  21. django_fast_treenode-2.1.4/treenode/models/mixins/ancestors.py +48 -0
  22. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/children.py +2 -1
  23. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/descendants.py +16 -22
  24. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/node.py +5 -21
  25. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/siblings.py +8 -8
  26. django_fast_treenode-2.1.4/treenode/static/.gitkeep +0 -0
  27. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/version.py +2 -2
  28. django_fast_treenode-2.1.2/docs/index.md +0 -30
  29. django_fast_treenode-2.1.2/docs/roadmap.md +0 -45
  30. django_fast_treenode-2.1.2/treenode/__init__.py +0 -5
  31. django_fast_treenode-2.1.2/treenode/cache.py +0 -231
  32. django_fast_treenode-2.1.2/treenode/models/mixins/ancestors.py +0 -65
  33. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/LICENSE +0 -0
  34. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/django_fast_treenode.egg-info/dependency_links.txt +0 -0
  35. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/django_fast_treenode.egg-info/top_level.txt +0 -0
  36. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/.gitignore +0 -0
  37. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/.nojekyll +0 -0
  38. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/import_export.md +0 -0
  39. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/installation.md +0 -0
  40. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/models.md +0 -0
  41. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/docs/requirements.txt +0 -0
  42. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/setup.py +0 -0
  43. /django_fast_treenode-2.1.2/treenode/static/.gitkeep → /django_fast_treenode-2.1.4/treenode/__init__.py +0 -0
  44. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/admin/__init__.py +0 -0
  45. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/admin/admin.py +0 -0
  46. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/admin/changelist.py +0 -0
  47. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/admin/mixins.py +0 -0
  48. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/apps.py +0 -0
  49. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/forms.py +0 -0
  50. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/managers/__init__.py +0 -0
  51. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/managers/closure.py +0 -0
  52. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/__init__.py +0 -0
  53. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/classproperty.py +0 -0
  54. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/factory.py +0 -0
  55. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/__init__.py +0 -0
  56. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/family.py +0 -0
  57. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/logical.py +0 -0
  58. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/properties.py +0 -0
  59. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/roots.py +0 -0
  60. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/models/mixins/tree.py +0 -0
  61. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/signals.py +0 -0
  62. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/static/treenode/.gitkeep +0 -0
  63. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/static/treenode/css/.gitkeep +0 -0
  64. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/static/treenode/css/tree_widget.css +0 -0
  65. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/static/treenode/css/treenode_admin.css +0 -0
  66. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/static/treenode/js/.gitkeep +0 -0
  67. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/static/treenode/js/tree_widget.js +0 -0
  68. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/static/treenode/js/treenode_admin.js +0 -0
  69. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/.gitkeep +0 -0
  70. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/admin/.gitkeep +0 -0
  71. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/admin/export_success.html +0 -0
  72. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/admin/tree_node_changelist.html +0 -0
  73. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/admin/tree_node_export.html +0 -0
  74. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/admin/tree_node_import.html +0 -0
  75. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/admin/tree_node_import_report.html +0 -0
  76. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/admin/treenode_ajax_rows.html +0 -0
  77. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/widgets/tree_widget.css +0 -0
  78. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/templates/widgets/tree_widget.html +0 -0
  79. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/urls.py +0 -0
  80. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/utils/__init__.py +0 -0
  81. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/utils/aid.py +0 -0
  82. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/utils/base16.py +0 -0
  83. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/utils/base36.py +0 -0
  84. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/utils/db.py +0 -0
  85. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/utils/exporter.py +0 -0
  86. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/utils/importer.py +0 -0
  87. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/utils/radix.py +0 -0
  88. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/views.py +0 -0
  89. {django_fast_treenode-2.1.2 → django_fast_treenode-2.1.4}/treenode/widgets.py +0 -0
@@ -3,3 +3,4 @@ include README.md
3
3
  recursive-include treenode/static *
4
4
  recursive-include treenode/templates *
5
5
  recursive-include docs *
6
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: django-fast-treenode
3
- Version: 2.1.2
3
+ Version: 2.1.4
4
4
  Summary: Application for supporting tree (hierarchical) data structure in Django projects
5
5
  Home-page: https://django-fast-treenode.readthedocs.io/
6
6
  Author: Timur Kady
@@ -55,19 +55,25 @@ License-File: LICENSE
55
55
  Requires-Dist: Django>=4.0
56
56
  Requires-Dist: pympler>=1.0
57
57
  Requires-Dist: django-widget-tweaks>=1.5
58
+ Requires-Dist: msgpack>=1.1
58
59
  Provides-Extra: import-export
59
60
  Requires-Dist: openpyxl; extra == "import-export"
60
61
  Requires-Dist: pyyaml; extra == "import-export"
61
62
  Requires-Dist: xlsxwriter; extra == "import-export"
62
63
 
63
64
  # Django-fast-treenode
64
- **Combining Adjacency List and Closure Table for Optimal Performance**
65
+ **Hybrid Tree Storage**
65
66
 
67
+ [![Tests](https://github.com/TimurKady/django-fast-treenode/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/TimurKady/django-fast-treenode/actions/workflows/test.yaml)
68
+ [![Docs](https://readthedocs.org/projects/django-fast-treenode/badge/?version=latest)](https://django-fast-treenode.readthedocs.io/)
69
+ [![PyPI](https://img.shields.io/pypi/v/django-fast-treenode.svg)](https://pypi.org/project/django-fast-treenode/)
70
+ [![Published on Django Packages](https://img.shields.io/badge/Published%20on-Django%20Packages-0c3c26)](https://djangopackages.org/packages/p/django-fast-treenode/)
71
+ [![Sponsor](https://img.shields.io/github/sponsors/TimurKady)](https://github.com/sponsors/TimurKady)
66
72
 
67
- **Django Fast TreeNode** is a high-performance Django application for working with tree structures, combining **Adjacency List** and **Closure Table** models. Each **TreeNodeModel** instance maintains two synchronized tables, enabling most operations to be performed with a single database query.
73
+ **Django Fast TreeNode** is a high-performance Django application for working with tree structures.
68
74
 
69
75
  ## Features
70
- - **Hybrid storage model**: Combines Adjacency List and Closure Table for optimal performance.
76
+ - **Hybrid storage model**: Combines Adjacency List and Materialized Path (versions 2.2 and above) Closure Table (versions 2.1 and earlier) for optimal performance.
71
77
  - **Custom caching system**: A built-in caching mechanism, specifically designed for this package, significantly boosts execution speed.
72
78
  - **Efficient queries**: Retrieve ancestors, descendants, breadcrumbs, and tree depth with only one SQL queriy.
73
79
  - **Bulk operations**: Supports fast insertion, movement, and deletion of nodes.
@@ -75,6 +81,8 @@ Requires-Dist: xlsxwriter; extra == "import-export"
75
81
  - **Admin panel integration**: Full compatibility with Django's admin panel, allowing intuitive management of tree structures.
76
82
  - **Import & Export functionality**: Built-in support for importing and exporting tree structures in multiple formats (CSV, JSON, XLSX, YAML, TSV), including integration with the Django admin panel.
77
83
 
84
+ It seems that django-fast-treenode is currently the most balanced and performant solution for most tasks, especially those related to dynamic hierarchical data structures. Check out the results of (comparison tests)[#] with other Django packages.
85
+
78
86
  ## Use Cases
79
87
  Django Fast TreeNode is suitable for a wide range of applications, from simple directories to complex systems with deep hierarchical structures:
80
88
  - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
@@ -155,4 +163,4 @@ Released under [MIT License](https://github.com/TimurKady/django-fast-treenode/b
155
163
  ## Credits
156
164
  Thanks to everyone who contributed to the development and testing of this package, as well as the Django community for their inspiration and support.
157
165
 
158
- Special thanks to [Fabio Caccamo](https://github.com/fabiocaccamo) for the idea behind creating a fast Django application for handling hierarchies and [Mathieu Leplatre](https://github.com/leplatrem) for the advice used in writing this application.
166
+ Special thanks to [Fabio Caccamo](https://github.com/fabiocaccamo) for the idea behind creating a fast Django application for handling hierarchies.
@@ -1,11 +1,16 @@
1
1
  # Django-fast-treenode
2
- **Combining Adjacency List and Closure Table for Optimal Performance**
2
+ **Hybrid Tree Storage**
3
3
 
4
+ [![Tests](https://github.com/TimurKady/django-fast-treenode/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/TimurKady/django-fast-treenode/actions/workflows/test.yaml)
5
+ [![Docs](https://readthedocs.org/projects/django-fast-treenode/badge/?version=latest)](https://django-fast-treenode.readthedocs.io/)
6
+ [![PyPI](https://img.shields.io/pypi/v/django-fast-treenode.svg)](https://pypi.org/project/django-fast-treenode/)
7
+ [![Published on Django Packages](https://img.shields.io/badge/Published%20on-Django%20Packages-0c3c26)](https://djangopackages.org/packages/p/django-fast-treenode/)
8
+ [![Sponsor](https://img.shields.io/github/sponsors/TimurKady)](https://github.com/sponsors/TimurKady)
4
9
 
5
- **Django Fast TreeNode** is a high-performance Django application for working with tree structures, combining **Adjacency List** and **Closure Table** models. Each **TreeNodeModel** instance maintains two synchronized tables, enabling most operations to be performed with a single database query.
10
+ **Django Fast TreeNode** is a high-performance Django application for working with tree structures.
6
11
 
7
12
  ## Features
8
- - **Hybrid storage model**: Combines Adjacency List and Closure Table for optimal performance.
13
+ - **Hybrid storage model**: Combines Adjacency List and Materialized Path (versions 2.2 and above) Closure Table (versions 2.1 and earlier) for optimal performance.
9
14
  - **Custom caching system**: A built-in caching mechanism, specifically designed for this package, significantly boosts execution speed.
10
15
  - **Efficient queries**: Retrieve ancestors, descendants, breadcrumbs, and tree depth with only one SQL queriy.
11
16
  - **Bulk operations**: Supports fast insertion, movement, and deletion of nodes.
@@ -13,6 +18,8 @@
13
18
  - **Admin panel integration**: Full compatibility with Django's admin panel, allowing intuitive management of tree structures.
14
19
  - **Import & Export functionality**: Built-in support for importing and exporting tree structures in multiple formats (CSV, JSON, XLSX, YAML, TSV), including integration with the Django admin panel.
15
20
 
21
+ It seems that django-fast-treenode is currently the most balanced and performant solution for most tasks, especially those related to dynamic hierarchical data structures. Check out the results of (comparison tests)[#] with other Django packages.
22
+
16
23
  ## Use Cases
17
24
  Django Fast TreeNode is suitable for a wide range of applications, from simple directories to complex systems with deep hierarchical structures:
18
25
  - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
@@ -93,4 +100,4 @@ Released under [MIT License](https://github.com/TimurKady/django-fast-treenode/b
93
100
  ## Credits
94
101
  Thanks to everyone who contributed to the development and testing of this package, as well as the Django community for their inspiration and support.
95
102
 
96
- Special thanks to [Fabio Caccamo](https://github.com/fabiocaccamo) for the idea behind creating a fast Django application for handling hierarchies and [Mathieu Leplatre](https://github.com/leplatrem) for the advice used in writing this application.
103
+ Special thanks to [Fabio Caccamo](https://github.com/fabiocaccamo) for the idea behind creating a fast Django application for handling hierarchies.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: django-fast-treenode
3
- Version: 2.1.2
3
+ Version: 2.1.4
4
4
  Summary: Application for supporting tree (hierarchical) data structure in Django projects
5
5
  Home-page: https://django-fast-treenode.readthedocs.io/
6
6
  Author: Timur Kady
@@ -55,19 +55,25 @@ License-File: LICENSE
55
55
  Requires-Dist: Django>=4.0
56
56
  Requires-Dist: pympler>=1.0
57
57
  Requires-Dist: django-widget-tweaks>=1.5
58
+ Requires-Dist: msgpack>=1.1
58
59
  Provides-Extra: import-export
59
60
  Requires-Dist: openpyxl; extra == "import-export"
60
61
  Requires-Dist: pyyaml; extra == "import-export"
61
62
  Requires-Dist: xlsxwriter; extra == "import-export"
62
63
 
63
64
  # Django-fast-treenode
64
- **Combining Adjacency List and Closure Table for Optimal Performance**
65
+ **Hybrid Tree Storage**
65
66
 
67
+ [![Tests](https://github.com/TimurKady/django-fast-treenode/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/TimurKady/django-fast-treenode/actions/workflows/test.yaml)
68
+ [![Docs](https://readthedocs.org/projects/django-fast-treenode/badge/?version=latest)](https://django-fast-treenode.readthedocs.io/)
69
+ [![PyPI](https://img.shields.io/pypi/v/django-fast-treenode.svg)](https://pypi.org/project/django-fast-treenode/)
70
+ [![Published on Django Packages](https://img.shields.io/badge/Published%20on-Django%20Packages-0c3c26)](https://djangopackages.org/packages/p/django-fast-treenode/)
71
+ [![Sponsor](https://img.shields.io/github/sponsors/TimurKady)](https://github.com/sponsors/TimurKady)
66
72
 
67
- **Django Fast TreeNode** is a high-performance Django application for working with tree structures, combining **Adjacency List** and **Closure Table** models. Each **TreeNodeModel** instance maintains two synchronized tables, enabling most operations to be performed with a single database query.
73
+ **Django Fast TreeNode** is a high-performance Django application for working with tree structures.
68
74
 
69
75
  ## Features
70
- - **Hybrid storage model**: Combines Adjacency List and Closure Table for optimal performance.
76
+ - **Hybrid storage model**: Combines Adjacency List and Materialized Path (versions 2.2 and above) Closure Table (versions 2.1 and earlier) for optimal performance.
71
77
  - **Custom caching system**: A built-in caching mechanism, specifically designed for this package, significantly boosts execution speed.
72
78
  - **Efficient queries**: Retrieve ancestors, descendants, breadcrumbs, and tree depth with only one SQL queriy.
73
79
  - **Bulk operations**: Supports fast insertion, movement, and deletion of nodes.
@@ -75,6 +81,8 @@ Requires-Dist: xlsxwriter; extra == "import-export"
75
81
  - **Admin panel integration**: Full compatibility with Django's admin panel, allowing intuitive management of tree structures.
76
82
  - **Import & Export functionality**: Built-in support for importing and exporting tree structures in multiple formats (CSV, JSON, XLSX, YAML, TSV), including integration with the Django admin panel.
77
83
 
84
+ It seems that django-fast-treenode is currently the most balanced and performant solution for most tasks, especially those related to dynamic hierarchical data structures. Check out the results of (comparison tests)[#] with other Django packages.
85
+
78
86
  ## Use Cases
79
87
  Django Fast TreeNode is suitable for a wide range of applications, from simple directories to complex systems with deep hierarchical structures:
80
88
  - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
@@ -155,4 +163,4 @@ Released under [MIT License](https://github.com/TimurKady/django-fast-treenode/b
155
163
  ## Credits
156
164
  Thanks to everyone who contributed to the development and testing of this package, as well as the Django community for their inspiration and support.
157
165
 
158
- Special thanks to [Fabio Caccamo](https://github.com/fabiocaccamo) for the idea behind creating a fast Django application for handling hierarchies and [Mathieu Leplatre](https://github.com/leplatrem) for the advice used in writing this application.
166
+ Special thanks to [Fabio Caccamo](https://github.com/fabiocaccamo) for the idea behind creating a fast Django application for handling hierarchies.
@@ -22,6 +22,7 @@ docs/migration.md
22
22
  docs/models.md
23
23
  docs/requirements.txt
24
24
  docs/roadmap.md
25
+ tests/test_suite.py
25
26
  treenode/__init__.py
26
27
  treenode/apps.py
27
28
  treenode/cache.py
@@ -72,7 +73,6 @@ treenode/templates/admin/tree_node_import_report.html
72
73
  treenode/templates/admin/treenode_ajax_rows.html
73
74
  treenode/templates/widgets/tree_widget.css
74
75
  treenode/templates/widgets/tree_widget.html
75
- treenode/tests/tests.py
76
76
  treenode/utils/__init__.py
77
77
  treenode/utils/aid.py
78
78
  treenode/utils/base16.py
@@ -1,6 +1,7 @@
1
1
  Django>=4.0
2
2
  pympler>=1.0
3
3
  django-widget-tweaks>=1.5
4
+ msgpack>=1.1
4
5
 
5
6
  [import_export]
6
7
  openpyxl
@@ -1,31 +1,36 @@
1
1
  ## About the project
2
2
  ### The Debut Idea
3
+
3
4
  The idea of ​​this package belongs to **[Fabio Caccamo](https://github.com/fabiocaccamo)**. His idea was to use the **Adjacency List** method to store the data tree. The most probable and time-consuming requests are calculated in advance and stored in the database. Also, most requests are cached. As a result, query processing is carried out in one call to the database or without it at all.
4
5
 
5
6
  The original application **[django-treenode](https://github.com/fabiocaccamo/django-treenode)** has significant advantages over other analogues, and indeed, is one of the best implementations of support for hierarchical structures for Django.
6
7
 
7
8
  However, this application has a number of undeniable shortcomings:
8
- * the selected pre-calculations scheme entails high costs for adding a new element;
9
- * inserting new elements uses signals, which leads to failures when using bulk-operations;
10
- * the problem of ordering elements by priority inside the parent node has not been resolved.
9
+
10
+ - the selected pre-calculations scheme entails high costs for adding a new element;
11
+ - inserting new elements uses signals, which leads to failures when using bulk-operations;
12
+ - the problem of ordering elements by priority inside the parent node has not been resolved.
11
13
 
12
14
  That is, an excellent debut idea, in my humble opinion, should have been improved.
13
15
 
14
16
  ### The Development of the Idea
17
+
15
18
  My idea was to solve these problems by combining the **Adjacency List** with the **Closure Table**. Main advantages:
16
- * the Closure Model is generated automatically;
17
- * maintained compatibility with the original package at the level of documented functions;
18
- * most requests are satisfied in one call to the database;
19
- * inserting a new element takes two calls to the database without signals usage;
20
- * bulk-operations are supported;
21
- * the cost of creating a new dependency is reduced many times;
22
- * useful functionality added for some methods (e.g. the `include_self=False` and `depth` parameters has been added to functions that return lists/querysets);
23
- * additionally, the package includes a tree view widget for the `tn_parent` field in the change form.
19
+
20
+ - the Closure Model is generated automatically;
21
+ - maintained compatibility with the original package at the level of documented functions;
22
+ - most requests are satisfied in one call to the database;
23
+ - inserting a new element takes two calls to the database without signals usage;
24
+ - bulk-operations are supported;
25
+ - the cost of creating a new dependency is reduced many times;
26
+ - useful functionality added for some methods (e.g. the `include_self=False` and `depth` parameters has been added to functions that return lists/querysets);
27
+ - additionally, the package includes a tree view widget for the `tn_parent` field in the change form.
24
28
 
25
29
  Of course, at large levels of nesting, the use of the Closure Table leads to an increase in resource costs. However, the combined approach still outperforms both the original application and other available Django solutions in terms of performance, especially in large trees with over 100k nodes.
26
30
 
27
31
  ### The Theory
28
32
  You can get a basic understanding of what is a **Closure Table** from:
33
+
29
34
  * [presentation](https://www.slideshare.net/billkarwin/models-for-hierarchical-data) by **Bill Karwin**;
30
35
  * [article](https://dirtsimple.org/2010/11/simplest-way-to-do-tree-based-queries.html) by blogger **Dirt Simple**;
31
36
  * [article](https://towardsdatascience.com/closure-table-pattern-to-model-hierarchies-in-nosql-c1be6a87e05b) by **Andriy Zabavskyy**.
@@ -33,4 +38,6 @@ You can get a basic understanding of what is a **Closure Table** from:
33
38
  You can easily find additional information on your own on the Internet.
34
39
 
35
40
  ### Our days
36
- Over the course of development, the package has undergone significant improvements, with a strong emphasis on performance optimization, database efficiency, and seamless integration with Django’s admin interface. The introduction of a hybrid model combining **Adjacency List** and **Closure Table** has substantially reduced query overhead, improved scalability, and enhanced flexibility when managing hierarchical data. These advancements have made the package not only a powerful but also a practical solution for working with large tree structures. Moving forward, the project will continue to evolve, focusing on refining caching mechanisms, expanding compatibility with Django’s ecosystem, and introducing further optimizations to ensure maximum efficiency and ease of use.
41
+ Over the course of development, the package has undergone significant improvements, with a strong emphasis on performance optimization, database efficiency, and seamless integration with Django’s admin interface.
42
+
43
+ The introduction of a hybrid model combining **Adjacency List** and **Closure Table** has substantially reduced query overhead, improved scalability, and enhanced flexibility when managing hierarchical data. These advancements have made the package not only a powerful but also a practical solution for working with large tree structures. Moving forward, the project will continue to evolve, focusing on refining caching mechanisms, expanding compatibility with Django’s ecosystem, and introducing further optimizations to ensure maximum efficiency and ease of use.
@@ -25,6 +25,7 @@ class CategoryAdmin(TreeNodeModelAdmin):
25
25
  The tree structure in the admin panel **loads dynamically as nodes are expanded**. This allows handling **large datasets** efficiently, preventing performance issues.
26
26
 
27
27
  You can choose from three display modes:
28
+
28
29
  - **`TREENODE_DISPLAY_MODE_ACCORDION` (default)**
29
30
  Expands/collapses nodes dynamically.
30
31
  - **`TREENODE_DISPLAY_MODE_BREADCRUMBS`**
@@ -43,10 +44,11 @@ The search bar helps quickly locate nodes within large trees. As you type, **an
43
44
 
44
45
  #### Using TreeNodeForm
45
46
  If you need to customize forms for tree-based models, inherit from `TreeNodeForm`. It provides:
47
+
46
48
  - A **custom tree widget** for selecting parent nodes.
47
49
  - Automatic **exclusion of self and descendants** from the parent selection to prevent circular references.
48
50
 
49
- ##### `forms.py`:
51
+ ##### forms.py:
50
52
  ```python
51
53
  from treenode.forms import TreeNodeForm
52
54
  from .models import Category
@@ -59,6 +61,7 @@ class CategoryForm(TreeNodeForm):
59
61
  ```
60
62
 
61
63
  Key Considerations:
64
+
62
65
  - This form automatically ensures that **a node cannot be its own parent**.
63
66
  - It uses **`TreeWidget`**, a custom hierarchical dropdown for selecting parent nodes.
64
67
  - If you need a form for another tree-based model, use the **dynamic factory method**:
@@ -75,7 +78,7 @@ This method ensures that the form correctly associates with different tree model
75
78
  #### The TreeWidget Class
76
79
  The `TreeWidget` class is a **custom Select2-like widget** that enables hierarchical selection in forms. While it is used inside the Django admin panel by default, it can **also be used in regular forms** outside the admin panel.
77
80
 
78
- ##### `widgets.py`
81
+ ##### widgets.py
79
82
 
80
83
  ```python
81
84
  from django import forms
@@ -91,6 +94,7 @@ class CategorySelectionForm(forms.Form):
91
94
  ```
92
95
 
93
96
  Important Notes:
97
+
94
98
  - **Requires jQuery**: The widget relies on AJAX requests, so ensure jQuery is available when using it outside Django’s admin.
95
99
  - **Dynamically Fetches Data**: It loads the tree structure asynchronously, preventing performance issues with large datasets.
96
100
  - **Customizable Data Source**: The `data-url` attribute can be adjusted to fetch tree data from a custom endpoint.
@@ -94,6 +94,7 @@ These methods are designed to manage **direct child nodes** within the tree stru
94
94
  obj.add_child(position=None, **kwargs)
95
95
  ```
96
96
  `position` specifies the order position of the object being added in the list of children of this node. It can be `'first-child'`, `'last-child'`, `'sorted-child'`, or an integer value.
97
+
97
98
  The `**kwargs` parameters contain the object creation data that will be passed to the inherited node model. Instead of passing the object creation data, you can pass an already created (but not yet saved) model instance to insert into the tree using the `instance` keyword.
98
99
 
99
100
  ```python
@@ -201,10 +202,10 @@ obj.get_family()
201
202
  ### Node Utility Methods
202
203
  This set of methods helps manage node-related operations such as:
203
204
 
204
- - **Breadcrumbs generation**
205
- - **Depth, index, and level calculations**
206
- - **Materialized path retrieval for sorting**
207
- - **Dynamic node positioning within the tree**
205
+ - Breadcrumbs generation
206
+ - Depth, index, and level calculations
207
+ - Materialized path retrieval for sorting
208
+ - Dynamic node positioning within the tree
208
209
 
209
210
  #### get_breadcrumbs
210
211
  Returns the **breadcrumbs** to current node (included):
@@ -246,19 +247,20 @@ obj.insert_at(target, position='first-child', save=False)
246
247
  ```
247
248
 
248
249
  Parameters:
250
+
249
251
  - `target`: еhe target node relative to which this node will be placed.
250
252
  - `position`: the position, relative to the target node, where the current node object will be moved to, can be one of:
251
- - `first-root`: the node will be the first root node;
252
- - `last-root`: the node will be the last root node;
253
- - `sorted-root`: the new node will be moved after sorting by the treenode_sort_field field;
254
- - `first-sibling`: the node will be the new leftmost sibling of the target node;
255
- - `left-sibling`: the node will take the target node’s place, which will be moved to the target position with shifting follows nodes;
256
- - `right-sibling`: the node will be moved to the position after the target node;
257
- - `last-sibling`: the node will be the new rightmost sibling of the target node;
258
- - `sorted-sibling`: the new node will be moved after sorting by the treenode_sort_field field;
259
- - first-child: the node will be the first child of the target node;
260
- - last-child: the node will be the new rightmost child of the target
261
- - sorted-child: the new node will be moved after sorting by the treenode_sort_field field.
253
+ - `first-root`: the node will be the first root node;
254
+ - `last-root`: the node will be the last root node;
255
+ - `sorted-root`: the new node will be moved after sorting by the treenode_sort_field field;
256
+ - `first-sibling`: the node will be the new leftmost sibling of the target node;
257
+ - `left-sibling`: the node will take the target node’s place, which will be moved to the target position with shifting follows nodes;
258
+ - `right-sibling`: the node will be moved to the position after the target node;
259
+ - `last-sibling`: the node will be the new rightmost sibling of the target node;
260
+ - `sorted-sibling`: the new node will be moved after sorting by the treenode_sort_field field;
261
+ - first-child: the node will be the first child of the target node;
262
+ - last-child: the node will be the new rightmost child of the target
263
+ - sorted-child: the new node will be moved after sorting by the treenode_sort_field field.
262
264
  - `save` : if `save=true`, the node will be saved in the tree. Otherwise, the method will return a model instance with updated fields: parent field and position in sibling list.
263
265
 
264
266
  Before using this method, the model instance must be correctly created with all required fields defined. If the model has required fields, then simply creating an object and calling insert_at() will not work, because Django will raise an exception.
@@ -268,9 +270,11 @@ Moves the model instance relative to the target node and sets its position (if n
268
270
  ```python
269
271
  obj.move_to(target, position=0)
270
272
  ```
273
+
271
274
  Parameters:
272
- - `target`: еhe target node relative to which this node will be placed.
273
- - `position` the position, relative to the target node, where the current node object will be moved to. For detals see [insert_at](#insert_at) method.
275
+
276
+ - `target`: the target node relative to which this node will be placed.
277
+ - `position`: the position, relative to the target node, where the current node object will be moved to. For detals see [insert_at](#insert_at) method.
274
278
 
275
279
  #### get_path
276
280
  Returns Materialized Path of node. The materialized path is constructed by recording the position of each node within its parent's list of children, tracing this sequence back through all its ancestors.
@@ -538,6 +542,7 @@ Something like this will be returned:
538
542
  All nodes are ordered by materialized path.
539
543
 
540
544
  This can be used with a template like this:
545
+
541
546
  ```html
542
547
  {% for item, info in annotated_list %}
543
548
  {% if info.open %}
@@ -546,7 +551,7 @@ This can be used with a template like this:
546
551
  </li><li>
547
552
  {% endif %}
548
553
 
549
- {{ item }}
554
+ {{ item }}
550
555
 
551
556
  {% for close in info.close %}
552
557
  </li></ul>
@@ -663,7 +668,7 @@ Returns the children pks list. See [`get_children_pks()`](#get_children_pks) met
663
668
  #### obj.depth
664
669
  Returns the node depth. See [`get_depth()`](#get_depth) method.
665
670
 
666
- ### obj.descendants:
671
+ #### obj.descendants:
667
672
  Returns a list containing all descendants (itself is not included). See [`get_descendants()`](#get_descendants) method.
668
673
 
669
674
  #### obj.descendants_count
@@ -693,7 +698,7 @@ Returns node parent pk. See [`get_parent_pk()`](#get_parent_pk) method.
693
698
  #### obj.priority
694
699
  Returns node oder position (priority). See [`get_priority()`](#get_priority) method.
695
700
 
696
- ### cls.roots
701
+ #### cls.roots
697
702
  Returns a list with all root nodes. See [`get_roots()`](#get_roots) method.
698
703
 
699
704
  #### obj.root
@@ -27,6 +27,7 @@ TREENODE_CACHE_LIMIT = 100
27
27
  **Automatic Management**. In most cases, users don’t need to manually manage cache operations.All methods that somehow change the state of models reset the tree cache automatically.
28
28
 
29
29
  **Manual Cache Clearing**. If for some reason you need to reset the cache, you can do it in two ways:
30
+
30
31
  - **Clear cache for a single model**: Use `clear_cache()` at the model level:
31
32
  ```python
32
33
  MyTreeNodeModel.clear_cache()
@@ -116,6 +117,7 @@ treenode_cache.clear()
116
117
  This completely resets the cache, removing **all stored values**.
117
118
 
118
119
  Best Practices:
120
+
119
121
  - **Always use `generate_cache_key()`** instead of hardcoding cache keys to ensure consistency.
120
122
  - **Use `invalidate()` instead of `clear()`** when targeting a specific model’s cache.
121
123
  - **Apply `@cached_method` wisely**, ensuring it is used **only for** `TreeNodeModel`-based methods to avoid conflicts.
@@ -137,6 +139,7 @@ The cache is now divided into two queues:
137
139
  - **LRU (20%-30%)** – for frequently accessed objects (Least Recently Used).
138
140
 
139
141
  How it works:
142
+
140
143
  - If tree queries are evenly distributed, the cache behaves like a standard FIFO.
141
144
  - If certain nodes receive frequent queries, those records automatically move to LRU, reducing database load.
142
145
 
@@ -145,10 +148,12 @@ How it works:
145
148
  Each new entry initially goes into **FIFO**. If accessed **more than N times**, it moves to **LRU**, where it remains longer.
146
149
 
147
150
  **How N is determined:**
151
+
148
152
  - A threshold is set based on **mathematical statistics**: N = 1 / sqrt(2).
149
153
  - An absolute threshold limit is added.
150
154
 
151
155
  **LRU Behavior:**
156
+
152
157
  - When accessed, a record moves to the top of the list.
153
158
  - New records are also placed at the top.
154
159
  - If LRU reaches capacity, **the evicted record returns to FIFO** instead of being deleted.
@@ -162,11 +167,13 @@ When data is modified or deleted, the cache **automatically resets** to prevent
162
167
  To automatically clear outdated records, an **adaptive mechanism** is used. Instead of a static TTL, the **DTT parameter** is dynamically calculated based on **Poisson distribution**.
163
168
 
164
169
  How DTT is calculated:
170
+
165
171
  1. Compute the **average interval between queries (T)**: ``` T = (1/N) * Σ (t_i - t_(i-1)), i=1...N```
166
172
  2. Store **averaged value** `ΣΔt / N`
167
173
  3. Set **DTT = 3T**, which removes **95% of infrequent queries**.
168
174
 
169
175
  **Why this is better than a fixed TTL:**
176
+
170
177
  - If queries are rare → DTT **increases**, preventing premature deletions.
171
178
  - If queries are frequent → DTT **decreases**, accelerating cache clearing.
172
179
 
@@ -0,0 +1,95 @@
1
+ # Django Fast TreeNode
2
+ **A Powerful Solution for Hierarchical Data Management**
3
+
4
+ Welcome to the **django-fast-treenode** documentation!
5
+
6
+ ## Overview
7
+
8
+ **Django Fast TreeNode** is a specialized Django package designed to efficiently handle hierarchical data structures. It leverages **combining Adjacency List and Closure Table** to optimize querying and management of tree-like structures, making it an excellent choice for applications that require fast traversal, retrieval, and manipulation of nested relationships.
9
+
10
+ The package is particularly useful in scenarios such as:
11
+
12
+ - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
13
+ - **Menus and navigation**: Create tree-like menus and nested navigation structures.
14
+ - **Forums and comments**: Store threaded discussions and nested comment chains.
15
+ - **Geographical data**: Represent administrative divisions, regions, and areas of influence.
16
+ - **Organizational and Business Structures**: Model company hierarchies, business processes, employees and departments.
17
+
18
+ **django-fast-treenode** models show excellent **performance** and **stability** in all applications.
19
+
20
+ ## Key Features
21
+
22
+ 1. **Efficient Tree Operations**:
23
+ * Supports fast retrieval of ancestors, descendants, and siblings.
24
+ * Uses a **closure table approach** for optimal query performance.
25
+
26
+ 2. **Django ORM Integration**:
27
+ * Extends Django’s `models.Model`, making it easy to integrate into existing applications.
28
+ * Custom manager (`TreeNodeManager`) provides useful tree-related query optimizations.
29
+
30
+
31
+ 3. **Query Optimization via Closure Table**
32
+ * Instead of naive recursive queries, the package precomputes relationships in a separate closure table.This allows you to run constant-time queries for retrieval using a **single database query**:
33
+ * Ancestors (`get_ancestors()`),
34
+ * Depth (`det_depth()`),
35
+ * Descendants (`get_descendants()`),
36
+ * Family (`get_family()`),
37
+ * Materialized Path(`get_breadcrumbs()` and `get_path()`),
38
+ * Roots (`get_root()`),
39
+ * Siblings (`get_siblings()`) and so on.
40
+
41
+ 4. **Automatic Ordering and Priority Management**:
42
+ * Nodes can be assigned priority values for custom sorting.
43
+ * Provides automatic ordering based on a **materialized path**.
44
+
45
+ 5. **Admin Interface Enhancements**:
46
+ * Supports multiple tree display modes in the Django Admin:
47
+ * **Indentation mode** (classic hierarchical view)
48
+ * **Breadcrumbs mode** (for easy navigation)
49
+ * **Accordion mode** (collapsible structures)
50
+ * Uses a **custom admin widget** (`TreeWidget`) to enhance usability.
51
+
52
+
53
+ 6. **Caching for Performance**:
54
+ * Uses Django’s caching framework to optimize frequently accessed tree operations.
55
+ * Cached tree methods reduce redundant computations.
56
+
57
+
58
+ 7. **Bulk Operations Support**:
59
+ * Implements efficient **bulk creation** of nodes.
60
+ * Provides methods for **batch updates** and **tree rebuilding**.
61
+
62
+ By leveraging combining with Closure Tables, it offers superior performance compared to traditional tree structures.
63
+
64
+ ## Use Cases and Benefits
65
+
66
+ ### When to Use Django Fast TreeNode?
67
+ - **You need a nested structure with frequent reads**: Closure tables provide **fast lookups** compared to recursive Common Table Expressions (CTEs).
68
+ - **You want an easy-to-use Django model**: The package **extends Django ORM** and integrates seamlessly.
69
+ - **You require hierarchical display in Django Admin**: The **custom admin integration** makes managing trees much easier.
70
+
71
+ ### Benefits Over Other Approaches
72
+ - **Better than adjacency lists** (which require multiple queries for deep trees).
73
+ - **More efficient than recursive queries** (which can be slow on large datasets).
74
+ - **Scalable for large trees** (by leveraging precomputed paths and caching).
75
+
76
+ Django Fast TreeNode is a powerful and efficient package for managing hierarchical data in Django applications. Its seamless ORM integration and Django Admin support make it a great choice for developers looking to implement **fast, scalable** tree-based data structures.
77
+
78
+ ## Contents
79
+ - [About the Project](about.md)
80
+ - [Installation, Configuration, and Fine-Tuning](installation.md)
81
+ - [Model Inheritance and Extensions](models.md)
82
+ - [Working with Admin Classes](admin.md)
83
+ - [API Reference](api.md)
84
+ - [Import & Export](import_export.md)
85
+ - [Caching and Cache Management](cache.md)
86
+ - [Migration and Upgrade Guide](migration.md)
87
+ - [Roadmap](roadmap.md)
88
+
89
+ ## Links
90
+ - [Issues](https://github.com/TimurKady/django-fast-treenode/issues)
91
+ - [Pull Requests](https://github.com/TimurKady/django-fast-treenode/pulls)
92
+ - [Discussions](https://github.com/TimurKady/django-fast-treenode/discussions)
93
+
94
+ ## License
95
+ Released under the [MIT License](https://github.com/TimurKady/django-fast-treenode/blob/main/LICENSE).
@@ -111,7 +111,7 @@ The `django-fast-treenode` package contains the full set of methods you are used
111
111
 
112
112
  |**django-treebeard** | **django-fast-treenode** |**Features of use**|
113
113
  |---------------------|----------------------|----------------------|
114
- | The `pos` parameter in `add_sibling()` and `move()` methods | The parameter `pos` has the name `position` | • The `position` parameter in `django-fast-treenode` always consists of two parts separated by `-`: the first part determines the insertion method (_first, left, right, last, sorted_), the second — the placement type (_child, sibling_). <br> • Instead of a string format, you can also pass position as an integer indicating the exact position of the node in the list.|
114
+ | The `pos` parameter in `add_sibling()` and `move()` methods | The parameter `pos` has the name `position` | • The `position` parameter in `django-fast-treenode` always consists of two parts separated by <br>`-`: the first part determines the insertion method (_first, left, right, last, sorted_), the second — the placement type (_child, sibling_). <br> • Instead of a string format, you can also pass position as an integer indicating the exact position of the node in the list.|
115
115
  |`get_siblings()`, `get_ancestors()` end ect. | Similar methods have parameters `include_self` and `depth` |• The `include_self` parameter specifies whether to include the node itself in the selection. <br> • The `depth` parameter specifies the depth of the search. |
116
116
  |`move(target, pos)` metiod| The method `move()` has the name `move_to(target, position)` | - |
117
117
 
@@ -0,0 +1,63 @@
1
+ ## Roadmap
2
+
3
+ ### Last Update
4
+ The latest version provides optimized database operations, an improved caching mechanism, and enhanced integration capabilities, making it a **robust and efficient choice** for handling tree structures.
5
+
6
+ **Version 2.1 – Compatibility and Optimization**
7
+ Reducing dependencies and simplifying migration from other libraries.
8
+
9
+ - **Expanding functionality** to simplify migration from other tree packages.
10
+ - Introducing node **filtering and search with AJAX**.
11
+ - **Optimizing query performance** by reducing query complexity and improving indexing strategies.
12
+ - **Reducing database load** from the `TreeNodeAdmin` when working with large trees.
13
+ - Removing `numpy` in favor of lighter alternatives.
14
+ - Removing `Select2` in favor of light custom select2-like implementation.
15
+
16
+
17
+ ### Planned Roadmap for Future Versions
18
+ The **django-fast-treenode** package will continue to evolve from its original concept—combining the benefits of the **Adjacency List** and **Closure Table** models—into a high-performance solution for managing and visualizing hierarchical data in Django projects. The focus is on **speed, usability, and flexibility**.
19
+
20
+ #### Version 2.2 – Performance Enhancements
21
+ Focusing on optimizing query efficiency, reducing database load, and improving API interactions.
22
+
23
+ - **Optimized Query Execution**: Minimize query overhead by restructuring SQL operations, reducing redundant lookups, and introducing batched operations for bulk inserts.
24
+ - **API-First CRUD Implementation**: Introduce full Create, Read, Update, and Delete (CRUD) operations for tree structures, ensuring seamless API-based interaction with hierarchical data.
25
+ - **Efficient Serialization**: Develop a lightweight tree serialization format optimized for API responses, reducing payload size while preserving structural integrity.
26
+ - **Advanced Node Filtering & Search**: Implement AJAX-based filtering and search mechanisms in Django Admin and API endpoints to enhance usability and response time.
27
+
28
+ #### Version 2.3 – Drag-and-Drop and Admin UI Improvements
29
+ Improving the usability and management of hierarchical structures in Django Admin.
30
+
31
+ - **Drag-and-Drop Node Reordering**: Introduce interactive drag-and-drop functionality for reordering nodes within the tree structure directly in Django Admin.
32
+ - **Hierarchical Sorting Strategies**: Enable various sorting methods, including manual ordering, weight-based prioritization, and hybrid approaches that combine automatic and manual sorting.
33
+ - **Admin Panel Enhancements**: Expand Django Admin capabilities for tree structures, including better visualization, inline node editing, and bulk actions.
34
+
35
+ #### Version 3.0 – Third-Generation Cache Management System
36
+ Introducing a more advanced caching system to improve scalability and efficiency.
37
+
38
+ - **Two-Level FIFO/LRU Cache**: Implement a hybrid caching mechanism combining First-In-First-Out (FIFO) and Least Recently Used (LRU) strategies to optimize cache retention for tree nodes.
39
+ - **Multi-Process Cache Synchronization**: Ensure cache consistency across different execution environments (WSGI, Gunicorn, Uvicorn) with a distributed synchronization mechanism.
40
+ - **Background Synchronization**: Introduce delayed closure table updates via Celery or RQ, preventing blocking operations while maintaining data consistency.
41
+
42
+ #### Version 4.0 – Asynchronous Operations
43
+ Refactoring the package to support fully asynchronous operations for non-blocking execution.
44
+
45
+ - **Asynchronous API Execution**: Convert existing synchronous operations to asynchronous, leveraging `async/await` for improved performance.
46
+ - **Async Database Support**: Implement async-friendly database operations compatible with Django’s evolving asynchronous ORM.
47
+ - **Optimized Tree Node Caching**: Shift from caching precomputed query results to caching raw tree nodes, reducing recomputation overhead and improving retrieval speed.
48
+ - **Asynchronous Testing**: Expand the test suite to cover async behavior and the new caching mechanism under concurrent loads.
49
+ - **Documentation Update**: Revise and expand documentation to reflect changes in the asynchronous execution model and best practices for implementation.
50
+
51
+ #### Version 5.0 – Beyond Django ORM
52
+ Decoupling tree structure management from Django’s ORM to increase flexibility and adaptability.
53
+
54
+ - **Multi-Backend Storage Support**: Introduce support for alternative storage engines beyond Django ORM, such as SQLAlchemy, custom PostgreSQL functions, and other database frameworks.
55
+ - **Redis Integration for In-Memory Trees**: Implement an optional Redis-based tree storage system, allowing high-speed in-memory hierarchy operations.
56
+ - **JSON-Based Storage Option**: Enable lightweight embedded tree storage using JSON structures, facilitating easier use in API-driven and microservice architectures.
57
+ - **ORM-Agnostic API Layer**: Design an API-first approach that allows tree structures to function independently from Django models, making the package usable in broader contexts.
58
+
59
+ So, each milestone is designed to improve performance, scalability, and flexibility, ensuring that the package remains relevant for modern web applications, API-driven architectures, and high-performance data processing environments support.
60
+
61
+ Stay tuned for updates!
62
+
63
+ Your wishes, objections, and comments are welcome.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "django-fast-treenode"
7
- version = "2.1.2"
7
+ version = "2.1.4"
8
8
  description = "Application for supporting tree (hierarchical) data structure in Django projects"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Timur Kady", email = "timurkady@yandex.com" }]
@@ -13,7 +13,8 @@ requires-python = ">=3.9"
13
13
  dependencies = [
14
14
  "Django >=4.0",
15
15
  "pympler >=1.0",
16
- "django-widget-tweaks >= 1.5"
16
+ "django-widget-tweaks >= 1.5",
17
+ "msgpack >= 1.1"
17
18
  ]
18
19
  classifiers = [
19
20
  "Development Status :: 5 - Production/Stable",
@@ -48,3 +49,4 @@ Homepage = "https://github.com/TimurKady/django-fast-treenode"
48
49
  Documentation = "https://django-fast-treenode.readthedocs.io/"
49
50
  Source = "https://github.com/TimurKady/django-fast-treenode"
50
51
  Issues = "https://github.com/TimurKady/django-fast-treenode/issues"
52
+