X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/949db689dc364fbff5384cd24dc8c1a9892369ab..37f95f6fd3e1da107a0eaf28c516e71206100bf4:/philo/contrib/penfield/models.py diff --git a/philo/contrib/penfield/models.py b/philo/contrib/penfield/models.py index adda629..eef8974 100644 --- a/philo/contrib/penfield/models.py +++ b/philo/contrib/penfield/models.py @@ -5,6 +5,7 @@ from django.conf.urls.defaults import url, patterns, include from django.db import models from django.http import Http404, HttpResponse from taggit.managers import TaggableManager +from taggit.models import Tag, TaggedItem from philo.contrib.winer.models import FeedView from philo.exceptions import ViewCanNotProvideSubpath @@ -27,7 +28,11 @@ class Blog(Entity): @property def entry_tags(self): """Returns a :class:`QuerySet` of :class:`.Tag`\ s that are used on any entries in this blog.""" - return Tag.objects.filter(blogentries__blog=self).distinct() + entry_pks = list(self.entries.values_list('pk', flat=True)) + kwargs = { + '%s__object_id__in' % TaggedItem.tag_relname(): entry_pks + } + return TaggedItem.tags_for(BlogEntry).filter(**kwargs) @property def entry_dates(self):