From 9f1d9b668a5de15e370dc0cd85997f458bbb2c98 Mon Sep 17 00:00:00 2001 From: jordan Date: Fri, 6 Apr 2012 14:04:20 +0000 Subject: [PATCH] make {% comments %} template tag decoratable and add ability to attach additional post controls to them git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1244 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/skins/default/templates/node/comments.html | 5 ++++- forum/templatetags/node_tags.py | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/forum/skins/default/templates/node/comments.html b/forum/skins/default/templates/node/comments.html index b34b58d..a84ef89 100644 --- a/forum/skins/default/templates/node/comments.html +++ b/forum/skins/default/templates/node/comments.html @@ -29,7 +29,10 @@ {% endif %} - + + {% if comment.additional_controls %} + {{ comment.additional_controls }} + {% endif %} ({% diff_date comment.added_at %}) {{comment.user.decorated_name}} diff --git a/forum/templatetags/node_tags.py b/forum/templatetags/node_tags.py index aee496a..2bc3c4b 100644 --- a/forum/templatetags/node_tags.py +++ b/forum/templatetags/node_tags.py @@ -192,8 +192,7 @@ def post_controls(post, user): return {'controls': controls, 'menu': menu, 'post': post, 'user': user} -@register.inclusion_tag('node/comments.html') -def comments(post, user): +def _comments(post, user): all_comments = post.comments.filter_state(deleted=False)\ .order_by('-added_at' if settings.SHOW_LATEST_COMMENTS_FIRST else 'added_at') @@ -250,6 +249,9 @@ def comments(post, user): 'user': user, } +@register.inclusion_tag('node/comments.html') +def comments(post, user): + return _comments(post, user) @register.inclusion_tag("node/contributors_info.html") def contributors_info(node, verb=None): -- 2.39.5