From 6e0ad555b25c2d9f3f28726f797edb3a51783af2 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Sat, 26 Jul 2008 13:09:20 +0200 Subject: [PATCH] * Enable threaded comments for influences. --- influences/views.py | 9 +++- .../influences/influence_detail_block.html | 53 +++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/influences/views.py b/influences/views.py index fec38f3..ea07c70 100644 --- a/influences/views.py +++ b/influences/views.py @@ -7,6 +7,8 @@ from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect, HttpResponseForbidden from django.views.generic.list_detail import object_detail, object_list +from threadedcomments.models import ThreadedComment +from threadedcomments.forms import ThreadedCommentForm from xerxes.influences.models import Character from xerxes.influences.models import Influence from xerxes.tools.forms import ContextModelForm @@ -103,6 +105,11 @@ def influence_detail(request, object_id): # Don't show other player's influences if (o.character.player != request.user): return HttpResponseForbidden("Forbidden -- Trying to view influences of somebody else's character") - return render_to_response('influences/influence_detail.html', {'object' : o}, RequestContext(request)) + context = { + 'object' : o, + 'comments' : ThreadedComment.public.get_tree(o), + 'comment_form' : ThreadedCommentForm(), + } + return render_to_response('influences/influence_detail.html', context, RequestContext(request)) # vim: set sts=4 sw=4 expandtab: diff --git a/templates/influences/influence_detail_block.html b/templates/influences/influence_detail_block.html index d2c1c3a..cc78c47 100644 --- a/templates/influences/influence_detail_block.html +++ b/templates/influences/influence_detail_block.html @@ -1,4 +1,5 @@ {% load i18n %} +{% load threadedcommentstags %}

{{ object.summary }}

@@ -9,3 +10,55 @@ {% endif %}

{{ object.description }}

+ + +

{% trans "Comments" %}

+{% if comments %} + {% for comment in comments %} +
+ {{ comment.user }} said:
+ {% auto_transform_markup comment %} + +
+ +
+

Cancel reply

+
    + + {{ comment.get_reply_form.as_table }} +
    + +
+
+
+
+ {% endfor %} +{% else %} + {% trans "No comments were added yet" %} +{% endif %} + + +
+ +

{% trans "Add comment" %}

+
+

Cancel comment

+
    + + {{ comment_form.as_table }} +
    + + +
+
+

-- 2.30.2