Getting "Comment post not allowed (400)" when using Django Comments

Posted by kfordham281 on Stack Overflow See other posts from Stack Overflow or by kfordham281
Published on 2009-07-13T15:25:50Z Indexed on 2010/04/20 11:13 UTC
Read the original article Hit count: 474

Filed under:
|
|

I'm going through a Django book and I seem to be stuck. The code base used in the book is .96 and I'm using 1.0 for my Django install. The portion I'm stuck at is related to Django comments (django.contrib.comments). When I submit my comments I get "Comment post not allowed (400) Why: Missing content_type or object_pk field". I've found the Django documentation to be a bit lacking in this area and I'm hoping to get some help.

The comment box is displayed just fine, it's when I submit the comment that I get the above error (or security warning as it truly appears).

My call to the comment form:

{% render_comment_form for bookmarks.sharedbookmark shared_bookmark.id %}

My form.html code:

{% if user.is_authenticated %}
    <form action="/comments/post/" method="post">
    	<p><label>Post a comment:</label><br />
    	<textarea name="comment" rows="10" cols="60"></textarea></p>
    	<input type="hidden" name="options" value="{{ options }}" />
    	<input type="hidden" name="target" value="{{ target }}" />
    	<input type="hidden" name="gonzo" value="{{ hash }}" />
    	<input type="submit" name="post" value="submit comment" />
    </form>
{% else %}
    <p>Please <a href="/login/">log in</a> to post comments.</p>
{% endif %}

Any help would be much appreciated.

My view as requested:

def bookmark_page(request, bookmark_id):
    shared_bookmark = get_object_or_404(
    	SharedBookmark,
    	id=bookmark_id
    )
    variables = RequestContext(request, {
    	'shared_bookmark': shared_bookmark
    })
    return render_to_response('bookmark_page.html', variables)

© Stack Overflow or respective owner

Related posts about django

Related posts about python