From 66e3ed2c34a8e751eb200b9c8e3c593208a2afa2 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Fri, 10 Jul 2015 11:23:31 +0000 Subject: fixed some bugs in enable_comments --- app/blog/admin.py | 1 + design/templates/details/entry.html | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/blog/admin.py b/app/blog/admin.py index c30244e..34c858d 100644 --- a/app/blog/admin.py +++ b/app/blog/admin.py @@ -60,6 +60,7 @@ class EntryAdmin(OSMGeoAdmin): 'meta_description', ('image', 'thumbnail'), 'template_name', + 'enable_comments', ), }), ) diff --git a/design/templates/details/entry.html b/design/templates/details/entry.html index 1641ace..ce71987 100644 --- a/design/templates/details/entry.html +++ b/design/templates/details/entry.html @@ -71,22 +71,26 @@ class="{%if t == 0 or t == 2 %}single{%endif%}{%if t == 1 or t == 3 %}double{%en {% include 'mailing_list.html' %} {% endcomment %} - -{% get_comment_count for object as comment_count %}. + {% if object.enable_comments %} +{% get_comment_count for object as comment_count %} {%if comment_count > 0 %}

{{comment_count}} Comment{{ comment_count|pluralize }}

{% render_comment_list for object %} {%endif%} {% render_comment_form for object %} +{% else %} +

Sorry, comments have been disabled for this post.

+{%endif%} {% endblock %} {% block js %} {% with object.get_template_name_display as t %}{%if t == "single" or t == "single-dark" %} {%endif%}{%endwith%} -