I use comment of Django applicaition, and the comment page looks
anything good, but when I post the comment, there is no comment
displayed on the page without any problem showing.

the template code:

        <h2>Comments</h2>
        {% get_comment_count for bookmarks.sharedbookmark
shared_bookmark.id as comment_count %}
        {% get_comment_list for bookmarks.sharedbookmark
shared_bookmark.id as comment_list %}
        {% for comment in comment_list %}
                <div class="comment">
                        <p>Posted by: {{ comment.user_name }} on
{{ comment.submit_date }}</p>
                        {{ comment.comment|escape|urlizetrunc:40|
linebreaks }}
                </div>
        {% endfor%}
        <p>Number of comments: {{ comment_count }}</p>
        {% render_comment_form for bookmarks.sharedbookmark
shared_bookmark.id %}

view.py:

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)

form.html:
{% if user.is_authenticated %}
    <form action="{{ comment_form_target }}" method="post">
        {% csrf_token %}
        <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 %}

I tried replace shared_bookmark.id with
object_pk,causing the page can't display the comment form.

How to fix this?
Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to