From 0ca12cc464e321be7cb7699911d1114b1af03c21 Mon Sep 17 00:00:00 2001 From: Stephen Burrows Date: Tue, 4 Jan 2011 13:16:57 -0500 Subject: [PATCH] Small tweaks to TreeModel.get_path to take advantage of updates to django-mptt. Updated README accordingly. --- README | 4 ++-- README.markdown | 4 ++-- models/base.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README b/README index 5ce7b93..4b1a6f7 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ Philo is a foundation for developing web content management systems. Prerequisites: * Python 2.5.4+ * Django 1.2+ - * django-mptt 0.4+ + * django-mptt e734079+ * (Optional) django-grappelli 2.0+ * (Optional) recaptcha-django r6 * (Optional) south 0.7.2+ @@ -20,4 +20,4 @@ After installing philo and mptt on your python path, make sure to complete the f 3. include 'philo.urls' somewhere in your urls.py file. 4. Optionally add a root node to your current Site. -Philo should be ready to go! \ No newline at end of file +Philo should be ready to go! diff --git a/README.markdown b/README.markdown index 0e695c5..8060db8 100644 --- a/README.markdown +++ b/README.markdown @@ -4,7 +4,7 @@ Prerequisites: * [Python 2.5.4+ <http://www.python.org>](http://www.python.org/) * [Django 1.2+ <http://www.djangoproject.com/>](http://www.djangoproject.com/) - * [django-mptt 0.4+ <https://github.com/django-mptt/django-mptt/>](https://github.com/django-mptt/django-mptt/) + * [django-mptt e734079+ <https://github.com/django-mptt/django-mptt/>](https://github.com/django-mptt/django-mptt/) * (Optional) [django-grappelli 2.0+ <http://code.google.com/p/django-grappelli/>](http://code.google.com/p/django-grappelli/) * (Optional) [south 0.7.2+ <http://south.aeracode.org/)](http://south.aeracode.org/) * (Optional) [recaptcha-django r6 <http://code.google.com/p/recaptcha-django/>](http://code.google.com/p/recaptcha-django/) @@ -21,4 +21,4 @@ After installing philo and mptt on your python path, make sure to complete the f 3. include 'philo.urls' somewhere in your urls.py file. 4. Optionally add a root node to your current Site. -Philo should be ready to go! \ No newline at end of file +Philo should be ready to go! diff --git a/models/base.py b/models/base.py index 3bcf394..290e8b8 100644 --- a/models/base.py +++ b/models/base.py @@ -425,12 +425,12 @@ class TreeModel(MPTTModel): if root is not None and not self.is_descendant_of(root): raise AncestorDoesNotExist(root) - qs = self.get_ancestors() + qs = self.get_ancestors(include_self=True) if root is not None: qs = qs.filter(**{'%s__gt' % self._mptt_meta.level_attr: root.get_level()}) - return pathsep.join([getattr(parent, field, '?') for parent in list(qs) + [self]]) + return pathsep.join([getattr(parent, field, '?') for parent in qs]) path = property(get_path) def __unicode__(self): -- 2.20.1