Django Comments Form not Displaying

64 views
Skip to first unread message

coded kid

unread,
Feb 12, 2012, 11:09:01 AM2/12/12
to Django users
Hi guys, please help me out with django-comments form. I added :
'django.contrib.comments', to INSTALLED APPS

(r'^comments/', include('django.contrib.comments.urls')), to urls.py
and I copied the default templates from
django.contrib.comments.templates.comments to my app templates
directory.

After doing that, I visit localhost:8000/comments/posts and the page
is not showing me any comments form, it just showing me a white blank
page. What I'm I doing wrong?

Below is the codes in my comments/form.html
{% load comments i18n %}
<form action="{% comment_form_target %}" method="post">{% csrf_token
%}
{% if next %}<div><input type="hidden" name="next"
value="{{ next }}" /></div>{% endif %}
{% for field in form %}
{% if field.is_hidden %}
<div>{{ field }}</div>
{% else %}
{% if field.errors %}{{ field.errors }}{% endif %}
<p
{% if field.errors %} class="error"{% endif %}
{% ifequal field.name "honeypot" %} style="display:none;"{%
endifequal %}>
{{ field.label_tag }} {{ field }}
</p>
{% endif %}
{% endfor %}
<p class="submit">
<input type="submit" name="post" class="submit-post" value="{%
trans "Post" %}" />
<input type="submit" name="preview" class="submit-preview"
value="{% trans "Preview" %}" />
</p>
</form>
Hope to hear from you soon.

Michael P. Soulier

unread,
Feb 12, 2012, 11:16:26 AM2/12/12
to django...@googlegroups.com

You have conditionals on all output. If you're seeing a blank page, perhaps
those conditionals are all false. Put in some unconditional content and see if
it renders, and then start testing your conditionals.

Mike

Matías Aguirre

unread,
Feb 12, 2012, 11:37:30 AM2/12/12
to Michael P. Soulier, django-users
Excerpts from Michael P. Soulier's message of 2012-02-12 14:16:26 -0200:

"/comments/post" is decorated by require_POST, that means that POST is the only
method allowed to access that view, check your response, you should be getting
a 405 response.

You should include the form in the page you want it to display, let's say
a blog post page, but if you want the form on a single page, then you need to
define a different URL and view to render the template.

Regards,
Matías
--
Matías Aguirre (matias...@gmail.com)

coded kid

unread,
Feb 13, 2012, 1:54:48 AM2/13/12
to Django users
Thanks guys. @matias I tried your solution, and the post button
appeared. After clicking on it, I get 'COMMENT POST NOT ALLOWED (404)'
Please whats wrong?
> Matías Aguirre (matiasagui...@gmail.com)
Reply all
Reply to author
Forward
0 new messages