Commits

Anonymous committed 82d7627

комментарии могут постить только авторизованные пользователи

Comments (0)

Files changed (3)

bsproj/custom_comments/models.py

+from django.contrib.comments.signals import comment_will_be_posted
+
+
+def comment_will_be_posted_callback(sender, **kwargs):
+    return kwargs['request'].user.is_authenticated()
+
+comment_will_be_posted.connect(comment_will_be_posted_callback)
+

bsproj/templates/brainstill/idea_detail.html

       </address>
       <p class="comment">{{ comment.comment|linebreaksbr }}</p>
     </li>
+    {% if forloop.last %}</ul>{% endif %}
   {% endfor %}
 
-  {% with idea.get_absolute_url as next %}
-    {% render_comment_form for idea %}
-  {% endwith %}
+  {% if user.is_authenticated %}
+    {% with idea.get_absolute_url as next %}
+      {% render_comment_form for idea %}
+    {% endwith %}
+  {% else %}
+    <p class="comments-not-authenticated">
+      {% url auth_login as auth_login_url %}
+      {% blocktrans %}<a href="{{ auth_login_url }}">Log in</a> to post comments.{% endblocktrans %}
+    </p>
+  {% endif %}
 {% endblock %}
   margin-top: 3ex;
   margin-bottom: 4ex;
 }
-ul.comments address {
+ul.comments address, p.comments-not-authenticated {
   font-size: 75%;
   color: #888a85;
 }