Django contrib.comments是否有任何现有的分页解决方案?

我需要的只是一个简单的分页django注释,对于我使用的基本博客应用程序(来自Django Basic Apps),使用简单的has_previous和has_next

我复制了django.contrib.comments并尝试修改代码但没有成功。代码很难理解(django / contrib / comments / templatetags / comments.py),因为它由Node和Parser组成

这是我用于Blog应用程序的comments.html模板:

{% load comments markup %}
{% get_comment_list for object as comment_list %}
    {% if comment_list %}
    <div class="comments g_7 left">
        <a name="comments"></a>
        <div class="subtitle">Comments</div>
        {% for comment in comment_list %}
            {% if comment.is_public %}
            <div class="comment g_6" id="c{{ comment.id }}">
                <div class="comment_name g_6">
                <div class="comment_count right">
                    <a name="c{{ comment.id }}" href="{{ comment.get_absolute_url }}" {% ifnotequal comment.person_name null %}title="Permalink to {{ comment.person_name }}'s comment"{% endifnotequal %} class="comment_count">{{ forloop.counter }}</a></div>
                    Wrote by <strong>{% if comment.user_url %}<a href="{{ comment.user_url }}">{{ comment.user_name }}</a>{% else %}{{ comment.user_name }}{% endif %}</strong> on {{ comment.submit_date|date:"F j, Y" }} - {{ comment.submit_date|date:"P" }} 
                </div>
                <div class="comment_body g_6">{{ comment.comment|urlizetrunc:"60"|safe }}</div>
            </div>
            {% endif %}
        {% endfor %}

        <div class="clear"></div>
    </div>
    {% else %}
        No comments yet.
    {% endif %}

我认为问题出在 get_comment_list templatetags:)

提前致谢

有帮助吗?

解决方案

我认为django-pagination可能就是你想要的。

http://code.google.com/p/django-pagination/(可提供截屏视频)

其他提示

Django还有一个内置的分页系统

https://docs.djangoproject.com/en/dev/topics/pagination /

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top