comparison 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
comparison
equal deleted inserted replaced
103:bb3f0d315c5f 104:59688577a8f1
110 last_page = page_num == paginator.num_pages 110 last_page = page_num == paginator.num_pages
111 111
112 # we do this for the template since it is rendered twice 112 # we do this for the template since it is rendered twice
113 page_nav = render_to_string('forums/pagination.html', {'page': page}) 113 page_nav = render_to_string('forums/pagination.html', {'page': page})
114 114
115 can_moderate = request.user.is_authenticated() and (
116 request.user.is_superuser or \
117 request.user in topic.forum.moderators.all())
118
119 can_reply = request.user.is_authenticated() and (
120 not topic.locked or can_moderate)
121
115 return render_to_response('forums/topic.html', { 122 return render_to_response('forums/topic.html', {
116 'forum': topic.forum, 123 'forum': topic.forum,
117 'topic': topic, 124 'topic': topic,
118 'page': page, 125 'page': page,
119 'page_nav': page_nav, 126 'page_nav': page_nav,
120 'last_page': last_page, 127 'last_page': last_page,
128 'can_moderate': can_moderate,
129 'can_reply': can_reply,
121 'form': PostForm(initial={'topic_id': topic.id}), 130 'form': PostForm(initial={'topic_id': topic.id}),
122 }, 131 },
123 context_instance=RequestContext(request)) 132 context_instance=RequestContext(request))
124 133
125 134