django-fast-treenode 2.0.11__tar.gz → 2.1.0__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 (95) hide show
  1. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/LICENSE +2 -2
  2. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/MANIFEST.in +1 -1
  3. django_fast_treenode-2.1.0/PKG-INFO +161 -0
  4. django_fast_treenode-2.1.0/README.md +99 -0
  5. django_fast_treenode-2.1.0/django_fast_treenode.egg-info/PKG-INFO +161 -0
  6. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/django_fast_treenode.egg-info/SOURCES.txt +38 -5
  7. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/django_fast_treenode.egg-info/requires.txt +0 -1
  8. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/pyproject.toml +1 -2
  9. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/setup.cfg +1 -2
  10. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/setup.py +1 -1
  11. django_fast_treenode-2.1.0/treenode/admin/__init__.py +9 -0
  12. django_fast_treenode-2.1.0/treenode/admin/admin.py +295 -0
  13. django_fast_treenode-2.1.0/treenode/admin/changelist.py +65 -0
  14. django_fast_treenode-2.1.0/treenode/admin/mixins.py +302 -0
  15. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/apps.py +12 -1
  16. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/cache.py +2 -2
  17. django_fast_treenode-2.1.0/treenode/docs/about.md +36 -0
  18. django_fast_treenode-2.1.0/treenode/docs/admin.md +104 -0
  19. django_fast_treenode-2.1.0/treenode/docs/api.md +739 -0
  20. django_fast_treenode-2.1.0/treenode/docs/cache.md +187 -0
  21. django_fast_treenode-2.1.0/treenode/docs/import_export.md +35 -0
  22. django_fast_treenode-2.1.0/treenode/docs/index.md +30 -0
  23. django_fast_treenode-2.1.0/treenode/docs/installation.md +74 -0
  24. django_fast_treenode-2.1.0/treenode/docs/migration.md +145 -0
  25. django_fast_treenode-2.1.0/treenode/docs/models.md +128 -0
  26. django_fast_treenode-2.1.0/treenode/docs/roadmap.md +45 -0
  27. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/forms.py +8 -10
  28. django_fast_treenode-2.1.0/treenode/managers/__init__.py +21 -0
  29. django_fast_treenode-2.1.0/treenode/managers/adjacency.py +203 -0
  30. django_fast_treenode-2.1.0/treenode/managers/closure.py +278 -0
  31. django_fast_treenode-2.1.0/treenode/models/__init__.py +8 -0
  32. django_fast_treenode-2.1.0/treenode/models/adjacency.py +343 -0
  33. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/models/classproperty.py +3 -0
  34. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/models/closure.py +23 -24
  35. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/models/factory.py +12 -2
  36. django_fast_treenode-2.1.0/treenode/models/mixins/__init__.py +23 -0
  37. django_fast_treenode-2.1.0/treenode/models/mixins/ancestors.py +65 -0
  38. django_fast_treenode-2.1.0/treenode/models/mixins/children.py +81 -0
  39. django_fast_treenode-2.1.0/treenode/models/mixins/descendants.py +66 -0
  40. django_fast_treenode-2.1.0/treenode/models/mixins/family.py +63 -0
  41. django_fast_treenode-2.1.0/treenode/models/mixins/logical.py +68 -0
  42. django_fast_treenode-2.1.0/treenode/models/mixins/node.py +210 -0
  43. django_fast_treenode-2.1.0/treenode/models/mixins/properties.py +156 -0
  44. django_fast_treenode-2.1.0/treenode/models/mixins/roots.py +96 -0
  45. django_fast_treenode-2.1.0/treenode/models/mixins/siblings.py +99 -0
  46. django_fast_treenode-2.1.0/treenode/models/mixins/tree.py +344 -0
  47. django_fast_treenode-2.1.0/treenode/signals.py +26 -0
  48. django_fast_treenode-2.1.0/treenode/static/.gitkeep +0 -0
  49. django_fast_treenode-2.1.0/treenode/static/treenode/css/tree_widget.css +232 -0
  50. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/static/treenode/css/treenode_admin.css +48 -41
  51. django_fast_treenode-2.1.0/treenode/static/treenode/js/tree_widget.js +299 -0
  52. django_fast_treenode-2.1.0/treenode/static/treenode/js/treenode_admin.js +131 -0
  53. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/templates/admin/tree_node_changelist.html +6 -0
  54. django_fast_treenode-2.1.0/treenode/templates/admin/treenode_ajax_rows.html +7 -0
  55. django_fast_treenode-2.1.0/treenode/tests/tests.py +488 -0
  56. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/urls.py +10 -6
  57. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/utils/__init__.py +2 -0
  58. django_fast_treenode-2.1.0/treenode/utils/aid.py +46 -0
  59. django_fast_treenode-2.1.0/treenode/utils/base16.py +38 -0
  60. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/utils/base36.py +3 -1
  61. django_fast_treenode-2.1.0/treenode/utils/db.py +116 -0
  62. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/utils/exporter.py +2 -0
  63. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/utils/importer.py +0 -1
  64. django_fast_treenode-2.1.0/treenode/utils/radix.py +61 -0
  65. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/version.py +2 -2
  66. django_fast_treenode-2.1.0/treenode/views.py +184 -0
  67. django_fast_treenode-2.1.0/treenode/widgets.py +129 -0
  68. django_fast_treenode-2.0.11/PKG-INFO +0 -698
  69. django_fast_treenode-2.0.11/README.md +0 -636
  70. django_fast_treenode-2.0.11/django_fast_treenode.egg-info/PKG-INFO +0 -698
  71. django_fast_treenode-2.0.11/treenode/admin.py +0 -439
  72. django_fast_treenode-2.0.11/treenode/docs/Documentation +0 -636
  73. django_fast_treenode-2.0.11/treenode/managers.py +0 -419
  74. django_fast_treenode-2.0.11/treenode/models/__init__.py +0 -7
  75. django_fast_treenode-2.0.11/treenode/models/proxy.py +0 -669
  76. django_fast_treenode-2.0.11/treenode/static/treenode/css/tree_widget.css +0 -62
  77. django_fast_treenode-2.0.11/treenode/static/treenode/js/tree_widget.js +0 -161
  78. django_fast_treenode-2.0.11/treenode/static/treenode/js/treenode_admin.js +0 -171
  79. django_fast_treenode-2.0.11/treenode/views.py +0 -109
  80. django_fast_treenode-2.0.11/treenode/widgets.py +0 -81
  81. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/django_fast_treenode.egg-info/dependency_links.txt +0 -0
  82. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/django_fast_treenode.egg-info/top_level.txt +0 -0
  83. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/__init__.py +0 -0
  84. /django_fast_treenode-2.0.11/treenode/static/.gitkeep → /django_fast_treenode-2.1.0/treenode/docs/.gitignore +0 -0
  85. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/static/treenode/.gitkeep +0 -0
  86. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/static/treenode/css/.gitkeep +0 -0
  87. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/static/treenode/js/.gitkeep +0 -0
  88. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/templates/.gitkeep +0 -0
  89. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/templates/admin/.gitkeep +0 -0
  90. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/templates/admin/export_success.html +0 -0
  91. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/templates/admin/tree_node_export.html +0 -0
  92. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/templates/admin/tree_node_import.html +0 -0
  93. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/templates/admin/tree_node_import_report.html +0 -0
  94. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/templates/widgets/tree_widget.css +0 -0
  95. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.0}/treenode/templates/widgets/tree_widget.html +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020-2023 Timur Kady
3
+ Copyright (c) 2020-2025 Timur Kady
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -2,4 +2,4 @@ include LICENSE
2
2
  include README.md
3
3
  recursive-include treenode/static *
4
4
  recursive-include treenode/templates *
5
- recursive-include treenode/docs *
5
+ recursive-include treenode/docs *
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.2
2
+ Name: django-fast-treenode
3
+ Version: 2.1.0
4
+ Summary: Application for supporting tree (hierarchical) data structure in Django projects
5
+ Home-page: https://github.com/TimurKady/django-fast-treenode
6
+ Author: Timur Kady
7
+ Author-email: Timur Kady <timurkady@yandex.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2020-2025 Timur Kady
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+
30
+ Project-URL: Homepage, https://github.com/TimurKady/django-fast-treenode
31
+ Project-URL: Documentation, https://github.com/TimurKady/django-fast-treenode#readme
32
+ Project-URL: Source, https://github.com/TimurKady/django-fast-treenode
33
+ Project-URL: Issues, https://github.com/TimurKady/django-fast-treenode/issues
34
+ Classifier: Development Status :: 5 - Production/Stable
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.9
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Programming Language :: Python :: 3.14
43
+ Classifier: Framework :: Django
44
+ Classifier: Framework :: Django :: 4.0
45
+ Classifier: Framework :: Django :: 4.1
46
+ Classifier: Framework :: Django :: 4.2
47
+ Classifier: Framework :: Django :: 5.0
48
+ Classifier: Framework :: Django :: 5.1
49
+ Classifier: Framework :: Django :: 5.2
50
+ Classifier: License :: OSI Approved :: MIT License
51
+ Classifier: Operating System :: OS Independent
52
+ Requires-Python: >=3.9
53
+ Description-Content-Type: text/markdown
54
+ License-File: LICENSE
55
+ Requires-Dist: Django>=4.0
56
+ Requires-Dist: pympler>=1.0
57
+ Requires-Dist: django-widget-tweaks>=1.5
58
+ Provides-Extra: import-export
59
+ Requires-Dist: openpyxl; extra == "import-export"
60
+ Requires-Dist: pyyaml; extra == "import-export"
61
+ Requires-Dist: xlsxwriter; extra == "import-export"
62
+
63
+
64
+ # ⚠️ Version 2.1.0 - betta.
65
+
66
+ # Django-fast-treenode
67
+ **Combining Adjacency List and Closure Table for Optimal Performance**
68
+
69
+
70
+ **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.
71
+
72
+ ## Features
73
+ - **Hybrid storage model**: Combines Adjacency List and Closure Table for optimal performance.
74
+ - **Custom caching system**: A built-in caching mechanism, specifically designed for this package, significantly boosts execution speed.
75
+ - **Efficient queries**: Retrieve ancestors, descendants, breadcrumbs, and tree depth with only one SQL queriy.
76
+ - **Bulk operations**: Supports fast insertion, movement, and deletion of nodes.
77
+ - **Flexibility**: Fully integrates with Django ORM and adapts to various business logic needs.
78
+ - **Admin panel integration**: Full compatibility with Django's admin panel, allowing intuitive management of tree structures.
79
+ - **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.
80
+
81
+ ## Use Cases
82
+ Django Fast TreeNode is suitable for a wide range of applications, from simple directories to complex systems with deep hierarchical structures:
83
+ - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
84
+ - **Menus and navigation**: Create tree-like menus and nested navigation structures.
85
+ - **Forums and comments**: Store threaded discussions and nested comment chains.
86
+ - **Geographical data**: Represent administrative divisions, regions, and areas of influence.
87
+ - **Organizational and Business Structures**: Model company hierarchies, business processes, employees and departments.
88
+
89
+ In all applications, `django-fast-treenode` models show excellent performance and stability.
90
+
91
+ ## Quick start
92
+ 1. Run `pip install django-fast-treenode`.
93
+ 2. Add `treenode` to `settings.INSTALLED_APPS`.
94
+
95
+ ```python
96
+ INSTALLED_APPS = [
97
+ ...
98
+ 'treenode',
99
+ ]
100
+ ```
101
+
102
+ 3. Define your model inherit from `treenode.models.TreeNodeModel`.
103
+
104
+ ```python
105
+ from treenode.models import TreeNodeModel
106
+
107
+ class Category(TreeNodeModel):
108
+ name = models.CharField(max_length=255)
109
+ treenode_display_field = "name"
110
+ ```
111
+
112
+ 4. Make your model-admin inherit from `treenode.admin.TreeNodeModelAdmin`.
113
+
114
+ ```python
115
+ from treenode.admin import TreeNodeModelAdmin
116
+ from .models import Category
117
+
118
+ @admin.register(Category)
119
+ class CategoryAdmin(TreeNodeModelAdmin):
120
+ list_display = ("name",)
121
+ search_fields = ("name",)
122
+ ```
123
+ 5. Run migrations.
124
+
125
+ ```bash
126
+ python manage.py makemigrations
127
+ python manage.py migrate
128
+ ```
129
+
130
+ 6. Run server and use!
131
+
132
+ ```bash
133
+ >>> root = Category.objects.create(name="Root")
134
+ >>> child = Category.objects.create(name="Child")
135
+ >>> child.set_parent(root)
136
+ >>> root_descendants_list = root.get_descendants()
137
+ >>> root_children_queryset = root.get_children_queryset()
138
+ >>> ancestors_pks = child.get_ancestors_pks()
139
+ ```
140
+
141
+ ## Documentation
142
+ Full documentation is available at [this link](#).
143
+
144
+ Quick access links:
145
+ * [Installation, configuration and fine tuning](#)
146
+ * [Model Inheritance and Extensions](#)
147
+ * [Working with Admin Classes](#)
148
+ * [API Reference](#)
149
+ * [Import & Export](#)
150
+ * [Caching and working with cache](#)
151
+ * [Migration and upgrade guide](#)
152
+
153
+ Your wishes, objections, comments are welcome.
154
+
155
+ ## License
156
+ Released under [MIT License](https://github.com/TimurKady/django-fast-treenode/blob/main/LICENSE).
157
+
158
+ ## Credits
159
+ Thanks to everyone who contributed to the development and testing of this package, as well as the Django community for their inspiration and support.
160
+
161
+ 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.
@@ -0,0 +1,99 @@
1
+
2
+ # ⚠️ Version 2.1.0 - betta.
3
+
4
+ # Django-fast-treenode
5
+ **Combining Adjacency List and Closure Table for Optimal Performance**
6
+
7
+
8
+ **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.
9
+
10
+ ## Features
11
+ - **Hybrid storage model**: Combines Adjacency List and Closure Table for optimal performance.
12
+ - **Custom caching system**: A built-in caching mechanism, specifically designed for this package, significantly boosts execution speed.
13
+ - **Efficient queries**: Retrieve ancestors, descendants, breadcrumbs, and tree depth with only one SQL queriy.
14
+ - **Bulk operations**: Supports fast insertion, movement, and deletion of nodes.
15
+ - **Flexibility**: Fully integrates with Django ORM and adapts to various business logic needs.
16
+ - **Admin panel integration**: Full compatibility with Django's admin panel, allowing intuitive management of tree structures.
17
+ - **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.
18
+
19
+ ## Use Cases
20
+ Django Fast TreeNode is suitable for a wide range of applications, from simple directories to complex systems with deep hierarchical structures:
21
+ - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
22
+ - **Menus and navigation**: Create tree-like menus and nested navigation structures.
23
+ - **Forums and comments**: Store threaded discussions and nested comment chains.
24
+ - **Geographical data**: Represent administrative divisions, regions, and areas of influence.
25
+ - **Organizational and Business Structures**: Model company hierarchies, business processes, employees and departments.
26
+
27
+ In all applications, `django-fast-treenode` models show excellent performance and stability.
28
+
29
+ ## Quick start
30
+ 1. Run `pip install django-fast-treenode`.
31
+ 2. Add `treenode` to `settings.INSTALLED_APPS`.
32
+
33
+ ```python
34
+ INSTALLED_APPS = [
35
+ ...
36
+ 'treenode',
37
+ ]
38
+ ```
39
+
40
+ 3. Define your model inherit from `treenode.models.TreeNodeModel`.
41
+
42
+ ```python
43
+ from treenode.models import TreeNodeModel
44
+
45
+ class Category(TreeNodeModel):
46
+ name = models.CharField(max_length=255)
47
+ treenode_display_field = "name"
48
+ ```
49
+
50
+ 4. Make your model-admin inherit from `treenode.admin.TreeNodeModelAdmin`.
51
+
52
+ ```python
53
+ from treenode.admin import TreeNodeModelAdmin
54
+ from .models import Category
55
+
56
+ @admin.register(Category)
57
+ class CategoryAdmin(TreeNodeModelAdmin):
58
+ list_display = ("name",)
59
+ search_fields = ("name",)
60
+ ```
61
+ 5. Run migrations.
62
+
63
+ ```bash
64
+ python manage.py makemigrations
65
+ python manage.py migrate
66
+ ```
67
+
68
+ 6. Run server and use!
69
+
70
+ ```bash
71
+ >>> root = Category.objects.create(name="Root")
72
+ >>> child = Category.objects.create(name="Child")
73
+ >>> child.set_parent(root)
74
+ >>> root_descendants_list = root.get_descendants()
75
+ >>> root_children_queryset = root.get_children_queryset()
76
+ >>> ancestors_pks = child.get_ancestors_pks()
77
+ ```
78
+
79
+ ## Documentation
80
+ Full documentation is available at [this link](#).
81
+
82
+ Quick access links:
83
+ * [Installation, configuration and fine tuning](#)
84
+ * [Model Inheritance and Extensions](#)
85
+ * [Working with Admin Classes](#)
86
+ * [API Reference](#)
87
+ * [Import & Export](#)
88
+ * [Caching and working with cache](#)
89
+ * [Migration and upgrade guide](#)
90
+
91
+ Your wishes, objections, comments are welcome.
92
+
93
+ ## License
94
+ Released under [MIT License](https://github.com/TimurKady/django-fast-treenode/blob/main/LICENSE).
95
+
96
+ ## Credits
97
+ Thanks to everyone who contributed to the development and testing of this package, as well as the Django community for their inspiration and support.
98
+
99
+ 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.
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.2
2
+ Name: django-fast-treenode
3
+ Version: 2.1.0
4
+ Summary: Application for supporting tree (hierarchical) data structure in Django projects
5
+ Home-page: https://github.com/TimurKady/django-fast-treenode
6
+ Author: Timur Kady
7
+ Author-email: Timur Kady <timurkady@yandex.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2020-2025 Timur Kady
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+
30
+ Project-URL: Homepage, https://github.com/TimurKady/django-fast-treenode
31
+ Project-URL: Documentation, https://github.com/TimurKady/django-fast-treenode#readme
32
+ Project-URL: Source, https://github.com/TimurKady/django-fast-treenode
33
+ Project-URL: Issues, https://github.com/TimurKady/django-fast-treenode/issues
34
+ Classifier: Development Status :: 5 - Production/Stable
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: Programming Language :: Python :: 3
37
+ Classifier: Programming Language :: Python :: 3.9
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: Programming Language :: Python :: 3.14
43
+ Classifier: Framework :: Django
44
+ Classifier: Framework :: Django :: 4.0
45
+ Classifier: Framework :: Django :: 4.1
46
+ Classifier: Framework :: Django :: 4.2
47
+ Classifier: Framework :: Django :: 5.0
48
+ Classifier: Framework :: Django :: 5.1
49
+ Classifier: Framework :: Django :: 5.2
50
+ Classifier: License :: OSI Approved :: MIT License
51
+ Classifier: Operating System :: OS Independent
52
+ Requires-Python: >=3.9
53
+ Description-Content-Type: text/markdown
54
+ License-File: LICENSE
55
+ Requires-Dist: Django>=4.0
56
+ Requires-Dist: pympler>=1.0
57
+ Requires-Dist: django-widget-tweaks>=1.5
58
+ Provides-Extra: import-export
59
+ Requires-Dist: openpyxl; extra == "import-export"
60
+ Requires-Dist: pyyaml; extra == "import-export"
61
+ Requires-Dist: xlsxwriter; extra == "import-export"
62
+
63
+
64
+ # ⚠️ Version 2.1.0 - betta.
65
+
66
+ # Django-fast-treenode
67
+ **Combining Adjacency List and Closure Table for Optimal Performance**
68
+
69
+
70
+ **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.
71
+
72
+ ## Features
73
+ - **Hybrid storage model**: Combines Adjacency List and Closure Table for optimal performance.
74
+ - **Custom caching system**: A built-in caching mechanism, specifically designed for this package, significantly boosts execution speed.
75
+ - **Efficient queries**: Retrieve ancestors, descendants, breadcrumbs, and tree depth with only one SQL queriy.
76
+ - **Bulk operations**: Supports fast insertion, movement, and deletion of nodes.
77
+ - **Flexibility**: Fully integrates with Django ORM and adapts to various business logic needs.
78
+ - **Admin panel integration**: Full compatibility with Django's admin panel, allowing intuitive management of tree structures.
79
+ - **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.
80
+
81
+ ## Use Cases
82
+ Django Fast TreeNode is suitable for a wide range of applications, from simple directories to complex systems with deep hierarchical structures:
83
+ - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
84
+ - **Menus and navigation**: Create tree-like menus and nested navigation structures.
85
+ - **Forums and comments**: Store threaded discussions and nested comment chains.
86
+ - **Geographical data**: Represent administrative divisions, regions, and areas of influence.
87
+ - **Organizational and Business Structures**: Model company hierarchies, business processes, employees and departments.
88
+
89
+ In all applications, `django-fast-treenode` models show excellent performance and stability.
90
+
91
+ ## Quick start
92
+ 1. Run `pip install django-fast-treenode`.
93
+ 2. Add `treenode` to `settings.INSTALLED_APPS`.
94
+
95
+ ```python
96
+ INSTALLED_APPS = [
97
+ ...
98
+ 'treenode',
99
+ ]
100
+ ```
101
+
102
+ 3. Define your model inherit from `treenode.models.TreeNodeModel`.
103
+
104
+ ```python
105
+ from treenode.models import TreeNodeModel
106
+
107
+ class Category(TreeNodeModel):
108
+ name = models.CharField(max_length=255)
109
+ treenode_display_field = "name"
110
+ ```
111
+
112
+ 4. Make your model-admin inherit from `treenode.admin.TreeNodeModelAdmin`.
113
+
114
+ ```python
115
+ from treenode.admin import TreeNodeModelAdmin
116
+ from .models import Category
117
+
118
+ @admin.register(Category)
119
+ class CategoryAdmin(TreeNodeModelAdmin):
120
+ list_display = ("name",)
121
+ search_fields = ("name",)
122
+ ```
123
+ 5. Run migrations.
124
+
125
+ ```bash
126
+ python manage.py makemigrations
127
+ python manage.py migrate
128
+ ```
129
+
130
+ 6. Run server and use!
131
+
132
+ ```bash
133
+ >>> root = Category.objects.create(name="Root")
134
+ >>> child = Category.objects.create(name="Child")
135
+ >>> child.set_parent(root)
136
+ >>> root_descendants_list = root.get_descendants()
137
+ >>> root_children_queryset = root.get_children_queryset()
138
+ >>> ancestors_pks = child.get_ancestors_pks()
139
+ ```
140
+
141
+ ## Documentation
142
+ Full documentation is available at [this link](#).
143
+
144
+ Quick access links:
145
+ * [Installation, configuration and fine tuning](#)
146
+ * [Model Inheritance and Extensions](#)
147
+ * [Working with Admin Classes](#)
148
+ * [API Reference](#)
149
+ * [Import & Export](#)
150
+ * [Caching and working with cache](#)
151
+ * [Migration and upgrade guide](#)
152
+
153
+ Your wishes, objections, comments are welcome.
154
+
155
+ ## License
156
+ Released under [MIT License](https://github.com/TimurKady/django-fast-treenode/blob/main/LICENSE).
157
+
158
+ ## Credits
159
+ Thanks to everyone who contributed to the development and testing of this package, as well as the Django community for their inspiration and support.
160
+
161
+ 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.
@@ -10,21 +10,48 @@ django_fast_treenode.egg-info/dependency_links.txt
10
10
  django_fast_treenode.egg-info/requires.txt
11
11
  django_fast_treenode.egg-info/top_level.txt
12
12
  treenode/__init__.py
13
- treenode/admin.py
14
13
  treenode/apps.py
15
14
  treenode/cache.py
16
15
  treenode/forms.py
17
- treenode/managers.py
16
+ treenode/signals.py
18
17
  treenode/urls.py
19
18
  treenode/version.py
20
19
  treenode/views.py
21
20
  treenode/widgets.py
22
- treenode/docs/Documentation
21
+ treenode/admin/__init__.py
22
+ treenode/admin/admin.py
23
+ treenode/admin/changelist.py
24
+ treenode/admin/mixins.py
25
+ treenode/docs/.gitignore
26
+ treenode/docs/about.md
27
+ treenode/docs/admin.md
28
+ treenode/docs/api.md
29
+ treenode/docs/cache.md
30
+ treenode/docs/import_export.md
31
+ treenode/docs/index.md
32
+ treenode/docs/installation.md
33
+ treenode/docs/migration.md
34
+ treenode/docs/models.md
35
+ treenode/docs/roadmap.md
36
+ treenode/managers/__init__.py
37
+ treenode/managers/adjacency.py
38
+ treenode/managers/closure.py
23
39
  treenode/models/__init__.py
40
+ treenode/models/adjacency.py
24
41
  treenode/models/classproperty.py
25
42
  treenode/models/closure.py
26
43
  treenode/models/factory.py
27
- treenode/models/proxy.py
44
+ treenode/models/mixins/__init__.py
45
+ treenode/models/mixins/ancestors.py
46
+ treenode/models/mixins/children.py
47
+ treenode/models/mixins/descendants.py
48
+ treenode/models/mixins/family.py
49
+ treenode/models/mixins/logical.py
50
+ treenode/models/mixins/node.py
51
+ treenode/models/mixins/properties.py
52
+ treenode/models/mixins/roots.py
53
+ treenode/models/mixins/siblings.py
54
+ treenode/models/mixins/tree.py
28
55
  treenode/static/.gitkeep
29
56
  treenode/static/treenode/.gitkeep
30
57
  treenode/static/treenode/css/.gitkeep
@@ -40,9 +67,15 @@ treenode/templates/admin/tree_node_changelist.html
40
67
  treenode/templates/admin/tree_node_export.html
41
68
  treenode/templates/admin/tree_node_import.html
42
69
  treenode/templates/admin/tree_node_import_report.html
70
+ treenode/templates/admin/treenode_ajax_rows.html
43
71
  treenode/templates/widgets/tree_widget.css
44
72
  treenode/templates/widgets/tree_widget.html
73
+ treenode/tests/tests.py
45
74
  treenode/utils/__init__.py
75
+ treenode/utils/aid.py
76
+ treenode/utils/base16.py
46
77
  treenode/utils/base36.py
78
+ treenode/utils/db.py
47
79
  treenode/utils/exporter.py
48
- treenode/utils/importer.py
80
+ treenode/utils/importer.py
81
+ treenode/utils/radix.py
@@ -1,6 +1,5 @@
1
1
  Django>=4.0
2
2
  pympler>=1.0
3
- numpy>=2.0
4
3
  django-widget-tweaks>=1.5
5
4
 
6
5
  [import_export]
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "django-fast-treenode"
7
- version = "2.0.11"
7
+ version = "2.1.0"
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,6 @@ requires-python = ">=3.9"
13
13
  dependencies = [
14
14
  "Django >=4.0",
15
15
  "pympler >=1.0",
16
- "numpy >=2.0",
17
16
  "django-widget-tweaks >= 1.5"
18
17
  ]
19
18
  classifiers = [
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = django-fast-treenode
3
- version = 2.0.11
3
+ version = 2.1.0
4
4
  description = Application for supporting tree (hierarchical) data structure in Django projects
5
5
  long_description = file: README.md
6
6
  long_description_content_type = text/markdown
@@ -34,7 +34,6 @@ python_requires = >=3.9
34
34
  install_requires =
35
35
  Django >=4.0
36
36
  pympler >=1.0
37
- numpy >=2.0
38
37
  django-widget-tweaks >= 1.5
39
38
 
40
39
  [options.extras_require]
@@ -1,3 +1,3 @@
1
1
  from setuptools import setup
2
2
 
3
- setup()
3
+ setup()
@@ -0,0 +1,9 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ from .admin import TreeNodeAdminModel
4
+
5
+
6
+ __all__ = ["TreeNodeAdminModel"]
7
+
8
+
9
+ # The end