X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/572eaacd575a0c80e478d8ba841e56c5ca43351c..8d3b1128e7925825332eafc7d269cf34e1af170c:/models/base.py diff --git a/models/base.py b/models/base.py index 0598407..202c2f3 100644 --- a/models/base.py +++ b/models/base.py @@ -402,6 +402,9 @@ class TreeModel(MPTTModel): slug = models.SlugField(max_length=255) def get_path(self, root=None, pathsep='/', field='slug'): + if root == self: + return '' + if root is not None and not self.is_descendant_of(root): raise AncestorDoesNotExist(root)