git.ithinksw.org
/
philo.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Corrections to Blog.entry_tags to use taggit APIs. Tweaks to penfield migration 0005...
[philo.git]
/
philo
/
contrib
/
penfield
/
models.py
diff --git
a/philo/contrib/penfield/models.py
b/philo/contrib/penfield/models.py
index
adda629
..
eef8974
100644
(file)
--- 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 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
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."""
@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):
@property
def entry_dates(self):