Django分页评论..有没有任何现有的解决方案? [英] Django Paginated Comments .. is there any existing solutions?

查看:223
本文介绍了Django分页评论..有没有任何现有的解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



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



这里是我的comments.html模板I用于博客应用程序:

  {%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>评论< / div>
{%for comment in comment_list%}
{%if comment.is_public%}
< div class =comment g_6id =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 =固定链接到{{comment.person_name} }的评论{%endifnotequal%} class =comment_count> {{forloop.counter}}< / a>< / div>
撰写者< 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%}
目前没有任何评论。
{%endif%}



我认为问题出在 get_comment_list templatetags:)



提前感谢

解决方案

认为django-pagination可能是你要找的。

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


is there any existing pagination solution for Django contrib.comments?

What I need is just a simple paginated django comments, for the Basic Blog application (from the Django Basic Apps) I used, using a simple has_previous and has_next

I have copied the django.contrib.comments and tried modify the code but with no success. The code is pretty hard to understand (django/contrib/comments/templatetags/comments.py) because it consists of Node and Parser

here is my comments.html template I used for the Blog application:

{% 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 %}

I think the problem lies in the get_comment_list templatetags :)

Thanks in advance

解决方案

I think django-pagination might be what you're looking for.

http://code.google.com/p/django-pagination/ (screencast available)

这篇关于Django分页评论..有没有任何现有的解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆