from django.conf.urls.defaults import url, patterns, include
from django.db import models
from django.http import Http404, HttpResponse
from django.conf.urls.defaults import url, patterns, include
from django.db import models
from django.http import Http404, HttpResponse
from philo.contrib.winer.models import FeedView
from philo.exceptions import ViewCanNotProvideSubpath
from philo.contrib.winer.models import FeedView
from philo.exceptions import ViewCanNotProvideSubpath
-from philo.models import Tag, Entity, Page, register_value_model
+from philo.models import Entity, Page, register_value_model
- 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)
- #: :class:`.Tag`\ s for this :class:`BlogEntry`.
- tags = models.ManyToManyField(Tag, related_name='blogentries', blank=True, null=True)
+ #: A ``django-taggit`` :class:`TaggableManager`.
+ tags = TaggableManager()
lede = TemplateField(null=True, blank=True, verbose_name='Summary')
#: A :class:`.TemplateField` containing the full text of the article.
full_text = TemplateField(db_index=True)
lede = TemplateField(null=True, blank=True, verbose_name='Summary')
#: A :class:`.TemplateField` containing the full text of the article.
full_text = TemplateField(db_index=True)
- #: A :class:`ManyToManyField` to :class:`.Tag`\ s for the :class:`NewsletterArticle`.
- tags = models.ManyToManyField(Tag, related_name='newsletterarticles', blank=True, null=True)
+ #: A ``django-taggit`` :class:`TaggableManager`.
+ tags = TaggableManager()