Ticket #9967: r10753_comment_linking_docs.diff

File r10753_comment_linking_docs.diff, 1.3 KB (added by Idan Gazit, 15 years ago)
  • docs/ref/contrib/comments/index.txt

    diff --git a/docs/ref/contrib/comments/index.txt b/docs/ref/contrib/comments/index.txt
    index f6e1553..3813bf2 100644
    a b This returns a list of :class:`~django.contrib.comments.models.Comment` objects;  
    104104see :ref:`the comment model documentation <ref-contrib-comments-models>` for
    105105details.
    106106
     107Linking to comments
     108-------------------
     109
     110To provide a permalink to a specific comment, use ``comment.get_absolute_url()``.
     111You will have to supply the named anchor at a suitable place in your template.
     112The name must be the letter 'c' followed by the comment id, for example 'c82'.
     113
     114For example::
     115
     116    {% for comment in comment_list %}
     117        <a name="c{{ comment.id }}"></a>
     118        <a href="{{ comment.get_absolute_url }}">
     119            permalink for comment #{{ forloop.counter }}
     120        </a>
     121        ...
     122    {% endfor %}
     123   
     124.. warning::
     125
     126    There's a known bug in Safari / webkit which causes the named anchor to be
     127    forgotten following a redirect. The practical impact for comments is that
     128    the Safari/webkit browsers will arrive at the correct page but will not
     129    scroll to the named anchor.
     130
    107131.. templatetag:: get_comment_count
    108132
    109133Counting comments
Back to Top