Comment post not allowed (400)

103 views
Skip to first unread message

coded kid

unread,
Feb 13, 2012, 4:28:24 AM2/13/12
to Django users
Hey guys, when I include the django comments form in the template I
want to use it, After visting the page, I can only see "POST" and
"PREVIEW" button and the form itself is not showing. So I clicked on
the 'POST" button to see what's next.

After clicking it, I get this:

Comment post not allowed (400)
Why: Missing content_type or object_pk field.

The comment you tried to post to this view wasn't saved because
something tampered with the security information in the comment form.
The message above should explain the problem, or you can check the
comment documentation for more help.

You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a
standard 400 error page.

Django Documents aint helping in this case. Please What I'm I missing?
below is the codes in my 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>

akaariai

unread,
Feb 14, 2012, 8:19:17 AM2/14/12
to Django users
A likely reason for the error is that you are missing all the fields
in the form. I haven't used the comments system, so I am not too sure
about this.

I would add some text (like HERE) as first thing to the "for field in
form" loop and see if that gets ever printed. If not, you have taken
first step in solving this. It would also be good to check the HTML-
source the page is generating.

- Anssi
Reply all
Reply to author
Forward
0 new messages