File tree 2 files changed +6
-5
lines changed 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 9
9
10
10
11
11
class TreeManager (models .Manager ):
12
- def get_queryset (self ):
12
+ def get_queryset (self ) -> TreeQuerySet [ "TreeModel" ] :
13
13
"""Returns a queryset with the models ordered by `path`"""
14
14
return TreeQuerySet (model = self .model , using = self ._db ).order_by ("path" )
15
15
16
- def roots (self ) -> models . QuerySet ["TreeModel" ]:
16
+ def roots (self ) -> TreeQuerySet ["TreeModel" ]:
17
17
"""Returns the roots of a given model"""
18
18
return self .filter ().roots ()
19
19
20
- def children (self , path : str ) -> models . QuerySet ["TreeModel" ]:
20
+ def children (self , path : str ) -> TreeQuerySet ["TreeModel" ]:
21
21
"""Returns the childrens of a given object"""
22
22
return self .filter ().children (path )
23
23
24
24
def create_child (
25
25
self , parent : "TreeModel" = None , ** kwargs
26
- ) -> models . QuerySet ["TreeModel" ]:
26
+ ) -> TreeQuerySet ["TreeModel" ]:
27
27
"""Creates a tree child with or without parent"""
28
28
paths_in_use = parent .children () if parent else self .roots ()
29
29
prefix = parent .path if parent else None
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ Installation
22
22
23
23
.. code-block :: python
24
24
25
+ # settings.py
25
26
INSTALLED_APPS = [
26
27
... ,
27
28
" django_ltree" ,
@@ -31,5 +32,5 @@ Installation
31
32
3. Run migrations:
32
33
33
34
.. code-block :: sh
34
-
35
+
35
36
./manage.py migrate
You can’t perform that action at this time.
0 commit comments