Mercurial > public > sg101
changeset 328:3f9b9fd54b01
Some optimizations to reduce database query times.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 22 Feb 2011 05:40:29 +0000 |
parents | a1bf6cf49720 |
children | 000c006fee97 |
files | gpp/forums/views/main.py |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/forums/views/main.py Tue Feb 22 02:11:26 2011 +0000 +++ b/gpp/forums/views/main.py Tue Feb 22 05:40:29 2011 +0000 @@ -127,8 +127,6 @@ } topics = forum.topics.select_related('user', 'last_post', 'last_post__user') - get_topic_unread_status(forum, topics, request.user) - paginator = create_topic_paginator(topics) page_num = get_page_num(request) try: @@ -136,6 +134,7 @@ except InvalidPage: raise Http404 + get_topic_unread_status(forum, page.object_list, request.user) attach_topic_page_ranges(page.object_list) # we do this for the template since it is rendered twice @@ -166,7 +165,7 @@ topic.view_count = F('view_count') + 1 topic.save(force_update=True) - posts = topic.posts.select_related() + posts = topic.posts.select_related(depth=1) paginator = create_post_paginator(posts) page_num = get_page_num(request)