git.ithinksw.org
/
philo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c0d3035
)
Corrected Node's get_path method to only fetch the path since the given root (if...
author
Stephen Burrows
<stephen.r.burrows@gmail.com>
Fri, 19 Nov 2010 06:46:38 +0000
(
01:46
-0500)
committer
Stephen Burrows
<stephen.r.burrows@gmail.com>
Mon, 29 Nov 2010 18:24:01 +0000
(13:24 -0500)
models/base.py
patch
|
blob
|
history
diff --git
a/models/base.py
b/models/base.py
index
37ab247
..
0598407
100644
(file)
--- a/
models/base.py
+++ b/
models/base.py
@@
-405,7
+405,12
@@
class TreeModel(MPTTModel):
if root is not None and not self.is_descendant_of(root):
raise AncestorDoesNotExist(root)
- return pathsep.join([getattr(parent, field, '?') for parent in list(self.get_ancestors()) + [self]])
+ qs = self.get_ancestors()
+
+ if root is not None:
+ qs = qs.filter(level__gt=root.level)
+
+ return pathsep.join([getattr(parent, field, '?') for parent in list(qs) + [self]])
path = property(get_path)
def __unicode__(self):