Mercurial > public > sg101
diff gpp/forums/views.py @ 114:535d02d1c017
Forums: Implemented unread status for topics and posts.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 11 Oct 2009 20:27:07 +0000 |
parents | d97ceb95ce02 |
children | 0ce0104c7df3 |
line wrap: on
line diff
--- a/gpp/forums/views.py Sun Oct 11 19:10:54 2009 +0000 +++ b/gpp/forums/views.py Sun Oct 11 20:27:07 2009 +0000 @@ -23,7 +23,8 @@ from forums.models import Forum, Topic, Post, FlaggedPost, TopicLastVisit, \ ForumLastVisit from forums.forms import NewTopicForm, NewPostForm, PostForm, MoveTopicForm -from forums.unread import get_forum_unread_status +from forums.unread import get_forum_unread_status, get_topic_unread_status, \ + get_post_unread_status ####################################################################### @@ -71,6 +72,8 @@ return HttpResponseForbidden() 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 = int(request.GET.get('page', 1)) try: @@ -105,6 +108,8 @@ topic.save() posts = topic.posts.select_related() + get_post_unread_status(topic, posts, request.user) + paginator = create_post_paginator(posts) page_num = int(request.GET.get('page', 1)) try: @@ -195,6 +200,7 @@ return HttpResponseForbidden("You don't have permission to post in this topic.") post = form.save(request.user, request.META.get("REMOTE_ADDR", "")) + post.unread = True _bump_post_count(request.user) _update_last_visit(request.user, form.topic) return render_to_response('forums/display_post.html', {