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
@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):