Mercurial > public > sg101
diff gpp/forums/views.py @ 104:59688577a8f1
Forums: display of sticky status. Moderators/superusers see IP address of post. Added a can_reply flag to the template and have view compute it.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 17 Sep 2009 01:44:51 +0000 |
parents | e67c4dd98db5 |
children | cb72577785df |
line wrap: on
line diff
--- a/gpp/forums/views.py Thu Sep 17 00:20:00 2009 +0000 +++ b/gpp/forums/views.py Thu Sep 17 01:44:51 2009 +0000 @@ -112,12 +112,21 @@ # we do this for the template since it is rendered twice page_nav = render_to_string('forums/pagination.html', {'page': page}) + can_moderate = request.user.is_authenticated() and ( + request.user.is_superuser or \ + request.user in topic.forum.moderators.all()) + + can_reply = request.user.is_authenticated() and ( + not topic.locked or can_moderate) + return render_to_response('forums/topic.html', { 'forum': topic.forum, 'topic': topic, 'page': page, 'page_nav': page_nav, 'last_page': last_page, + 'can_moderate': can_moderate, + 'can_reply': can_reply, 'form': PostForm(initial={'topic_id': topic.id}), }, context_instance=RequestContext(request))