X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/abb612415838c36da12f53560a2546ae8c43abdd..21810d334ed2e309304560fe26133bb95f212963:/models.py diff --git a/models.py b/models.py index 41e9a15..e32265d 100644 --- a/models.py +++ b/models.py @@ -163,10 +163,10 @@ class TreeModel(models.Model): slug = models.SlugField() def get_path(self, pathsep='/', field='slug'): - path = getattr(self, field) + path = getattr(self, field, '?') parent = self.parent while parent: - path = getattr(parent, field) + pathsep + path + path = getattr(parent, field, '?') + pathsep + path parent = parent.parent return path path = property(get_path) @@ -199,10 +199,10 @@ class Node(TreeEntity): instance_type = models.ForeignKey(ContentType, editable=False) def get_path(self, pathsep='/', field='slug'): - path = getattr(self.instance, field) + path = getattr(self.instance, field, '?') parent = self.parent while parent: - path = getattr(parent.instance, field) + pathsep + path + path = getattr(parent.instance, field, '?') + pathsep + path parent = parent.parent return path path = property(get_path)