# HG changeset patch # User Brian Neal # Date 1253151891 0 # Node ID 59688577a8f14d4bdf1e1e5f26d87be775ebfbfb # Parent bb3f0d315c5f8d36b510d944a08a7e407a94168c 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. diff -r bb3f0d315c5f -r 59688577a8f1 gpp/forums/views.py --- 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)) diff -r bb3f0d315c5f -r 59688577a8f1 gpp/templates/forums/display_post.html --- a/gpp/templates/forums/display_post.html Thu Sep 17 00:20:00 2009 +0000 +++ b/gpp/templates/forums/display_post.html Thu Sep 17 01:44:51 2009 +0000 @@ -12,6 +12,8 @@
Link Posted on {{ post.creation_date|date:"M d, Y H:i" }} + {% if can_moderate %}from IP: {{ post.user_ip }}{% endif %} +
{{ post.html|safe }} diff -r bb3f0d315c5f -r 59688577a8f1 gpp/templates/forums/topic.html --- a/gpp/templates/forums/topic.html Thu Sep 17 00:20:00 2009 +0000 +++ b/gpp/templates/forums/topic.html Thu Sep 17 01:44:51 2009 +0000 @@ -11,9 +11,14 @@
+{% if topic.sticky %} +Sticky +{% endif %} {% if topic.locked %} Lock -{% else %} +{% endif %} +{% if can_reply %} +{% if topic.locked or topic.sticky %}•{% endif %} {% if last_page %} New Reply {% else %} @@ -30,7 +35,7 @@ {{ page_nav }} -{% if last_page and user.is_authenticated and not topic.locked %} +{% if last_page and can_reply %}