Mercurial > public > sg101
changeset 391:0398aae48807
Another tweak to the forum feeds query; see #191.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 23 Mar 2011 00:44:06 +0000 |
parents | e0523e17ea43 |
children | 79240675b903 |
files | gpp/forums/feeds.py |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/forums/feeds.py Mon Mar 21 00:39:52 2011 +0000 +++ b/gpp/forums/feeds.py Wed Mar 23 00:44:06 2011 +0000 @@ -67,14 +67,15 @@ posts = [] for forum_id in public_forum_ids: posts.extend(list(Post.objects.filter( - topic__forum__id=forum_id).order_by('-creation_date').select_related(depth=2)[:30])) + topic__forum=forum_id).order_by('-creation_date').select_related( + 'topic', 'user', 'topic__forum')[:30])) posts.sort(key=lambda x: x.creation_date, reverse=True) return posts[:30] else: return Post.objects.filter(topic__forum__id=obj.id).order_by( - '-creation_date').select_related(depth=2)[:30] + '-creation_date').select_related('topic', 'user', 'topic__forum')[:30] def item_title(self, item): return item.topic.name