django-fast-treenode 2.0.11__tar.gz → 2.1.1__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 (84) hide show
  1. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/LICENSE +2 -2
  2. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/MANIFEST.in +1 -1
  3. django_fast_treenode-2.1.1/PKG-INFO +158 -0
  4. django_fast_treenode-2.1.1/README.md +96 -0
  5. django_fast_treenode-2.1.1/django_fast_treenode.egg-info/PKG-INFO +158 -0
  6. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/django_fast_treenode.egg-info/SOURCES.txt +27 -5
  7. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/django_fast_treenode.egg-info/requires.txt +0 -1
  8. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/pyproject.toml +2 -3
  9. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/setup.cfg +1 -2
  10. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/setup.py +1 -1
  11. django_fast_treenode-2.1.1/treenode/admin/__init__.py +9 -0
  12. django_fast_treenode-2.1.1/treenode/admin/admin.py +295 -0
  13. django_fast_treenode-2.1.1/treenode/admin/changelist.py +65 -0
  14. django_fast_treenode-2.1.1/treenode/admin/mixins.py +302 -0
  15. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/apps.py +12 -1
  16. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/cache.py +2 -2
  17. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/forms.py +8 -10
  18. django_fast_treenode-2.1.1/treenode/managers/__init__.py +21 -0
  19. django_fast_treenode-2.1.1/treenode/managers/adjacency.py +203 -0
  20. django_fast_treenode-2.1.1/treenode/managers/closure.py +278 -0
  21. django_fast_treenode-2.1.1/treenode/models/__init__.py +8 -0
  22. django_fast_treenode-2.1.1/treenode/models/adjacency.py +343 -0
  23. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/models/classproperty.py +3 -0
  24. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/models/closure.py +23 -24
  25. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/models/factory.py +12 -2
  26. django_fast_treenode-2.1.1/treenode/models/mixins/__init__.py +23 -0
  27. django_fast_treenode-2.1.1/treenode/models/mixins/ancestors.py +65 -0
  28. django_fast_treenode-2.1.1/treenode/models/mixins/children.py +81 -0
  29. django_fast_treenode-2.1.1/treenode/models/mixins/descendants.py +66 -0
  30. django_fast_treenode-2.1.1/treenode/models/mixins/family.py +63 -0
  31. django_fast_treenode-2.1.1/treenode/models/mixins/logical.py +68 -0
  32. django_fast_treenode-2.1.1/treenode/models/mixins/node.py +210 -0
  33. django_fast_treenode-2.1.1/treenode/models/mixins/properties.py +156 -0
  34. django_fast_treenode-2.1.1/treenode/models/mixins/roots.py +96 -0
  35. django_fast_treenode-2.1.1/treenode/models/mixins/siblings.py +99 -0
  36. django_fast_treenode-2.1.1/treenode/models/mixins/tree.py +344 -0
  37. django_fast_treenode-2.1.1/treenode/signals.py +26 -0
  38. django_fast_treenode-2.1.1/treenode/static/treenode/css/tree_widget.css +232 -0
  39. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/static/treenode/css/treenode_admin.css +48 -41
  40. django_fast_treenode-2.1.1/treenode/static/treenode/js/tree_widget.js +299 -0
  41. django_fast_treenode-2.1.1/treenode/static/treenode/js/treenode_admin.js +131 -0
  42. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/templates/admin/tree_node_changelist.html +6 -0
  43. django_fast_treenode-2.1.1/treenode/templates/admin/treenode_ajax_rows.html +7 -0
  44. django_fast_treenode-2.1.1/treenode/tests/tests.py +488 -0
  45. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/urls.py +10 -6
  46. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/utils/__init__.py +2 -0
  47. django_fast_treenode-2.1.1/treenode/utils/aid.py +46 -0
  48. django_fast_treenode-2.1.1/treenode/utils/base16.py +38 -0
  49. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/utils/base36.py +3 -1
  50. django_fast_treenode-2.1.1/treenode/utils/db.py +116 -0
  51. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/utils/exporter.py +2 -0
  52. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/utils/importer.py +0 -1
  53. django_fast_treenode-2.1.1/treenode/utils/radix.py +61 -0
  54. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/version.py +2 -2
  55. django_fast_treenode-2.1.1/treenode/views.py +184 -0
  56. django_fast_treenode-2.1.1/treenode/widgets.py +129 -0
  57. django_fast_treenode-2.0.11/PKG-INFO +0 -698
  58. django_fast_treenode-2.0.11/README.md +0 -636
  59. django_fast_treenode-2.0.11/django_fast_treenode.egg-info/PKG-INFO +0 -698
  60. django_fast_treenode-2.0.11/treenode/admin.py +0 -439
  61. django_fast_treenode-2.0.11/treenode/docs/Documentation +0 -636
  62. django_fast_treenode-2.0.11/treenode/managers.py +0 -419
  63. django_fast_treenode-2.0.11/treenode/models/__init__.py +0 -7
  64. django_fast_treenode-2.0.11/treenode/models/proxy.py +0 -669
  65. django_fast_treenode-2.0.11/treenode/static/treenode/css/tree_widget.css +0 -62
  66. django_fast_treenode-2.0.11/treenode/static/treenode/js/tree_widget.js +0 -161
  67. django_fast_treenode-2.0.11/treenode/static/treenode/js/treenode_admin.js +0 -171
  68. django_fast_treenode-2.0.11/treenode/views.py +0 -109
  69. django_fast_treenode-2.0.11/treenode/widgets.py +0 -81
  70. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/django_fast_treenode.egg-info/dependency_links.txt +0 -0
  71. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/django_fast_treenode.egg-info/top_level.txt +0 -0
  72. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/__init__.py +0 -0
  73. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/static/.gitkeep +0 -0
  74. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/static/treenode/.gitkeep +0 -0
  75. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/static/treenode/css/.gitkeep +0 -0
  76. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/static/treenode/js/.gitkeep +0 -0
  77. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/templates/.gitkeep +0 -0
  78. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/templates/admin/.gitkeep +0 -0
  79. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/templates/admin/export_success.html +0 -0
  80. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/templates/admin/tree_node_export.html +0 -0
  81. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/templates/admin/tree_node_import.html +0 -0
  82. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/templates/admin/tree_node_import_report.html +0 -0
  83. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/treenode/templates/widgets/tree_widget.css +0 -0
  84. {django_fast_treenode-2.0.11 → django_fast_treenode-2.1.1}/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,158 @@
1
+ Metadata-Version: 2.2
2
+ Name: django-fast-treenode
3
+ Version: 2.1.1
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://django-fast-treenode.readthedocs.io/latest/
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
+ # Django-fast-treenode
64
+ **Combining Adjacency List and Closure Table for Optimal Performance**
65
+
66
+
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.
68
+
69
+ ## Features
70
+ - **Hybrid storage model**: Combines Adjacency List and Closure Table for optimal performance.
71
+ - **Custom caching system**: A built-in caching mechanism, specifically designed for this package, significantly boosts execution speed.
72
+ - **Efficient queries**: Retrieve ancestors, descendants, breadcrumbs, and tree depth with only one SQL queriy.
73
+ - **Bulk operations**: Supports fast insertion, movement, and deletion of nodes.
74
+ - **Flexibility**: Fully integrates with Django ORM and adapts to various business logic needs.
75
+ - **Admin panel integration**: Full compatibility with Django's admin panel, allowing intuitive management of tree structures.
76
+ - **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
+
78
+ ## Use Cases
79
+ Django Fast TreeNode is suitable for a wide range of applications, from simple directories to complex systems with deep hierarchical structures:
80
+ - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
81
+ - **Menus and navigation**: Create tree-like menus and nested navigation structures.
82
+ - **Forums and comments**: Store threaded discussions and nested comment chains.
83
+ - **Geographical data**: Represent administrative divisions, regions, and areas of influence.
84
+ - **Organizational and Business Structures**: Model company hierarchies, business processes, employees and departments.
85
+
86
+ In all applications, `django-fast-treenode` models show excellent performance and stability.
87
+
88
+ ## Quick start
89
+ 1. Run `pip install django-fast-treenode`.
90
+ 2. Add `treenode` to `settings.INSTALLED_APPS`.
91
+
92
+ ```python
93
+ INSTALLED_APPS = [
94
+ ...
95
+ 'treenode',
96
+ ]
97
+ ```
98
+
99
+ 3. Define your model inherit from `treenode.models.TreeNodeModel`.
100
+
101
+ ```python
102
+ from treenode.models import TreeNodeModel
103
+
104
+ class Category(TreeNodeModel):
105
+ name = models.CharField(max_length=255)
106
+ treenode_display_field = "name"
107
+ ```
108
+
109
+ 4. Make your model-admin inherit from `treenode.admin.TreeNodeModelAdmin`.
110
+
111
+ ```python
112
+ from treenode.admin import TreeNodeModelAdmin
113
+ from .models import Category
114
+
115
+ @admin.register(Category)
116
+ class CategoryAdmin(TreeNodeModelAdmin):
117
+ list_display = ("name",)
118
+ search_fields = ("name",)
119
+ ```
120
+ 5. Run migrations.
121
+
122
+ ```bash
123
+ python manage.py makemigrations
124
+ python manage.py migrate
125
+ ```
126
+
127
+ 6. Run server and use!
128
+
129
+ ```bash
130
+ >>> root = Category.objects.create(name="Root")
131
+ >>> child = Category.objects.create(name="Child")
132
+ >>> child.set_parent(root)
133
+ >>> root_descendants_list = root.get_descendants()
134
+ >>> root_children_queryset = root.get_children_queryset()
135
+ >>> ancestors_pks = child.get_ancestors_pks()
136
+ ```
137
+
138
+ ## Documentation
139
+ Full documentation is available at [this link](https://django-fast-treenode.readthedocs.io/latest/).
140
+
141
+ Quick access links:
142
+ * [Installation, configuration and fine tuning](https://django-fast-treenode.readthedocs.io/latest/installation/)
143
+ * [Model Inheritance and Extensions](https://django-fast-treenode.readthedocs.io/latest/models/)
144
+ * [Working with Admin Classes](https://django-fast-treenode.readthedocs.io/latest/admin/)
145
+ * [API Reference](https://django-fast-treenode.readthedocs.io/latest/api/)
146
+ * [Import & Export](https://django-fast-treenode.readthedocs.io/latest/import_export/)
147
+ * [Caching and working with cache](https://django-fast-treenode.readthedocs.io/latest/cache/)
148
+ * [Migration and upgrade guide](https://django-fast-treenode.readthedocs.io/latest/migration/)
149
+
150
+ Your wishes, objections, comments are welcome.
151
+
152
+ ## License
153
+ Released under [MIT License](https://github.com/TimurKady/django-fast-treenode/blob/main/LICENSE).
154
+
155
+ ## Credits
156
+ 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
+
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.
@@ -0,0 +1,96 @@
1
+ # Django-fast-treenode
2
+ **Combining Adjacency List and Closure Table for Optimal Performance**
3
+
4
+
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.
6
+
7
+ ## Features
8
+ - **Hybrid storage model**: Combines Adjacency List and Closure Table for optimal performance.
9
+ - **Custom caching system**: A built-in caching mechanism, specifically designed for this package, significantly boosts execution speed.
10
+ - **Efficient queries**: Retrieve ancestors, descendants, breadcrumbs, and tree depth with only one SQL queriy.
11
+ - **Bulk operations**: Supports fast insertion, movement, and deletion of nodes.
12
+ - **Flexibility**: Fully integrates with Django ORM and adapts to various business logic needs.
13
+ - **Admin panel integration**: Full compatibility with Django's admin panel, allowing intuitive management of tree structures.
14
+ - **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
+
16
+ ## Use Cases
17
+ Django Fast TreeNode is suitable for a wide range of applications, from simple directories to complex systems with deep hierarchical structures:
18
+ - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
19
+ - **Menus and navigation**: Create tree-like menus and nested navigation structures.
20
+ - **Forums and comments**: Store threaded discussions and nested comment chains.
21
+ - **Geographical data**: Represent administrative divisions, regions, and areas of influence.
22
+ - **Organizational and Business Structures**: Model company hierarchies, business processes, employees and departments.
23
+
24
+ In all applications, `django-fast-treenode` models show excellent performance and stability.
25
+
26
+ ## Quick start
27
+ 1. Run `pip install django-fast-treenode`.
28
+ 2. Add `treenode` to `settings.INSTALLED_APPS`.
29
+
30
+ ```python
31
+ INSTALLED_APPS = [
32
+ ...
33
+ 'treenode',
34
+ ]
35
+ ```
36
+
37
+ 3. Define your model inherit from `treenode.models.TreeNodeModel`.
38
+
39
+ ```python
40
+ from treenode.models import TreeNodeModel
41
+
42
+ class Category(TreeNodeModel):
43
+ name = models.CharField(max_length=255)
44
+ treenode_display_field = "name"
45
+ ```
46
+
47
+ 4. Make your model-admin inherit from `treenode.admin.TreeNodeModelAdmin`.
48
+
49
+ ```python
50
+ from treenode.admin import TreeNodeModelAdmin
51
+ from .models import Category
52
+
53
+ @admin.register(Category)
54
+ class CategoryAdmin(TreeNodeModelAdmin):
55
+ list_display = ("name",)
56
+ search_fields = ("name",)
57
+ ```
58
+ 5. Run migrations.
59
+
60
+ ```bash
61
+ python manage.py makemigrations
62
+ python manage.py migrate
63
+ ```
64
+
65
+ 6. Run server and use!
66
+
67
+ ```bash
68
+ >>> root = Category.objects.create(name="Root")
69
+ >>> child = Category.objects.create(name="Child")
70
+ >>> child.set_parent(root)
71
+ >>> root_descendants_list = root.get_descendants()
72
+ >>> root_children_queryset = root.get_children_queryset()
73
+ >>> ancestors_pks = child.get_ancestors_pks()
74
+ ```
75
+
76
+ ## Documentation
77
+ Full documentation is available at [this link](https://django-fast-treenode.readthedocs.io/latest/).
78
+
79
+ Quick access links:
80
+ * [Installation, configuration and fine tuning](https://django-fast-treenode.readthedocs.io/latest/installation/)
81
+ * [Model Inheritance and Extensions](https://django-fast-treenode.readthedocs.io/latest/models/)
82
+ * [Working with Admin Classes](https://django-fast-treenode.readthedocs.io/latest/admin/)
83
+ * [API Reference](https://django-fast-treenode.readthedocs.io/latest/api/)
84
+ * [Import & Export](https://django-fast-treenode.readthedocs.io/latest/import_export/)
85
+ * [Caching and working with cache](https://django-fast-treenode.readthedocs.io/latest/cache/)
86
+ * [Migration and upgrade guide](https://django-fast-treenode.readthedocs.io/latest/migration/)
87
+
88
+ Your wishes, objections, comments are welcome.
89
+
90
+ ## License
91
+ Released under [MIT License](https://github.com/TimurKady/django-fast-treenode/blob/main/LICENSE).
92
+
93
+ ## Credits
94
+ 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
+
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.
@@ -0,0 +1,158 @@
1
+ Metadata-Version: 2.2
2
+ Name: django-fast-treenode
3
+ Version: 2.1.1
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://django-fast-treenode.readthedocs.io/latest/
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
+ # Django-fast-treenode
64
+ **Combining Adjacency List and Closure Table for Optimal Performance**
65
+
66
+
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.
68
+
69
+ ## Features
70
+ - **Hybrid storage model**: Combines Adjacency List and Closure Table for optimal performance.
71
+ - **Custom caching system**: A built-in caching mechanism, specifically designed for this package, significantly boosts execution speed.
72
+ - **Efficient queries**: Retrieve ancestors, descendants, breadcrumbs, and tree depth with only one SQL queriy.
73
+ - **Bulk operations**: Supports fast insertion, movement, and deletion of nodes.
74
+ - **Flexibility**: Fully integrates with Django ORM and adapts to various business logic needs.
75
+ - **Admin panel integration**: Full compatibility with Django's admin panel, allowing intuitive management of tree structures.
76
+ - **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
+
78
+ ## Use Cases
79
+ Django Fast TreeNode is suitable for a wide range of applications, from simple directories to complex systems with deep hierarchical structures:
80
+ - **Categories and taxonomies**: Manage product categories, tags, and classification systems.
81
+ - **Menus and navigation**: Create tree-like menus and nested navigation structures.
82
+ - **Forums and comments**: Store threaded discussions and nested comment chains.
83
+ - **Geographical data**: Represent administrative divisions, regions, and areas of influence.
84
+ - **Organizational and Business Structures**: Model company hierarchies, business processes, employees and departments.
85
+
86
+ In all applications, `django-fast-treenode` models show excellent performance and stability.
87
+
88
+ ## Quick start
89
+ 1. Run `pip install django-fast-treenode`.
90
+ 2. Add `treenode` to `settings.INSTALLED_APPS`.
91
+
92
+ ```python
93
+ INSTALLED_APPS = [
94
+ ...
95
+ 'treenode',
96
+ ]
97
+ ```
98
+
99
+ 3. Define your model inherit from `treenode.models.TreeNodeModel`.
100
+
101
+ ```python
102
+ from treenode.models import TreeNodeModel
103
+
104
+ class Category(TreeNodeModel):
105
+ name = models.CharField(max_length=255)
106
+ treenode_display_field = "name"
107
+ ```
108
+
109
+ 4. Make your model-admin inherit from `treenode.admin.TreeNodeModelAdmin`.
110
+
111
+ ```python
112
+ from treenode.admin import TreeNodeModelAdmin
113
+ from .models import Category
114
+
115
+ @admin.register(Category)
116
+ class CategoryAdmin(TreeNodeModelAdmin):
117
+ list_display = ("name",)
118
+ search_fields = ("name",)
119
+ ```
120
+ 5. Run migrations.
121
+
122
+ ```bash
123
+ python manage.py makemigrations
124
+ python manage.py migrate
125
+ ```
126
+
127
+ 6. Run server and use!
128
+
129
+ ```bash
130
+ >>> root = Category.objects.create(name="Root")
131
+ >>> child = Category.objects.create(name="Child")
132
+ >>> child.set_parent(root)
133
+ >>> root_descendants_list = root.get_descendants()
134
+ >>> root_children_queryset = root.get_children_queryset()
135
+ >>> ancestors_pks = child.get_ancestors_pks()
136
+ ```
137
+
138
+ ## Documentation
139
+ Full documentation is available at [this link](https://django-fast-treenode.readthedocs.io/latest/).
140
+
141
+ Quick access links:
142
+ * [Installation, configuration and fine tuning](https://django-fast-treenode.readthedocs.io/latest/installation/)
143
+ * [Model Inheritance and Extensions](https://django-fast-treenode.readthedocs.io/latest/models/)
144
+ * [Working with Admin Classes](https://django-fast-treenode.readthedocs.io/latest/admin/)
145
+ * [API Reference](https://django-fast-treenode.readthedocs.io/latest/api/)
146
+ * [Import & Export](https://django-fast-treenode.readthedocs.io/latest/import_export/)
147
+ * [Caching and working with cache](https://django-fast-treenode.readthedocs.io/latest/cache/)
148
+ * [Migration and upgrade guide](https://django-fast-treenode.readthedocs.io/latest/migration/)
149
+
150
+ Your wishes, objections, comments are welcome.
151
+
152
+ ## License
153
+ Released under [MIT License](https://github.com/TimurKady/django-fast-treenode/blob/main/LICENSE).
154
+
155
+ ## Credits
156
+ 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
+
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.
@@ -10,21 +10,37 @@ 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/managers/__init__.py
26
+ treenode/managers/adjacency.py
27
+ treenode/managers/closure.py
23
28
  treenode/models/__init__.py
29
+ treenode/models/adjacency.py
24
30
  treenode/models/classproperty.py
25
31
  treenode/models/closure.py
26
32
  treenode/models/factory.py
27
- treenode/models/proxy.py
33
+ treenode/models/mixins/__init__.py
34
+ treenode/models/mixins/ancestors.py
35
+ treenode/models/mixins/children.py
36
+ treenode/models/mixins/descendants.py
37
+ treenode/models/mixins/family.py
38
+ treenode/models/mixins/logical.py
39
+ treenode/models/mixins/node.py
40
+ treenode/models/mixins/properties.py
41
+ treenode/models/mixins/roots.py
42
+ treenode/models/mixins/siblings.py
43
+ treenode/models/mixins/tree.py
28
44
  treenode/static/.gitkeep
29
45
  treenode/static/treenode/.gitkeep
30
46
  treenode/static/treenode/css/.gitkeep
@@ -40,9 +56,15 @@ treenode/templates/admin/tree_node_changelist.html
40
56
  treenode/templates/admin/tree_node_export.html
41
57
  treenode/templates/admin/tree_node_import.html
42
58
  treenode/templates/admin/tree_node_import_report.html
59
+ treenode/templates/admin/treenode_ajax_rows.html
43
60
  treenode/templates/widgets/tree_widget.css
44
61
  treenode/templates/widgets/tree_widget.html
62
+ treenode/tests/tests.py
45
63
  treenode/utils/__init__.py
64
+ treenode/utils/aid.py
65
+ treenode/utils/base16.py
46
66
  treenode/utils/base36.py
67
+ treenode/utils/db.py
47
68
  treenode/utils/exporter.py
48
- treenode/utils/importer.py
69
+ treenode/utils/importer.py
70
+ 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.1"
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 = [
@@ -46,6 +45,6 @@ import_export = [
46
45
 
47
46
  [project.urls]
48
47
  Homepage = "https://github.com/TimurKady/django-fast-treenode"
49
- Documentation = "https://github.com/TimurKady/django-fast-treenode#readme"
48
+ Documentation = "https://django-fast-treenode.readthedocs.io/latest/"
50
49
  Source = "https://github.com/TimurKady/django-fast-treenode"
51
50
  Issues = "https://github.com/TimurKady/django-fast-treenode/issues"
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = django-fast-treenode
3
- version = 2.0.11
3
+ version = 2.1.1
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