Added get_path fallback to slug to increase information flow by reducing the number...
[philo.git] / models.py
index 6be9951..b66c4c3 100644 (file)
--- a/models.py
+++ b/models.py
@@ -220,10 +220,10 @@ class InheritableTreeEntity(TreeEntity):
                        return None
        
        def get_path(self, pathsep='/', field='slug'):
-               path = getattr(self.instance, field, '?')
+               path = getattr(self.instance, field, getattr(self.instance, 'slug', '?'))
                parent = self.parent
                while parent:
-                       path = getattr(parent.instance, field, '?') + pathsep + path
+                       path = getattr(parent.instance, field, getattr(parent.instance, 'slug', '?')) + pathsep + path
                        parent = parent.parent
                return path
        path = property(get_path)
@@ -283,9 +283,6 @@ class Redirect(Node):
                response = HttpResponseRedirect(self.target)
                response.status_code = self.status_code
                return response
-       
-       def __unicode__(self):
-               return self.slug
 
 
 class File(Node):