【发布时间】:2010-11-04 22:06:16
【问题描述】:
有没有针对 Django contrib.cmets 的现有分页解决方案?
我需要的只是一个简单的分页 django cmets,用于我使用的 Basic Blog 应用程序(来自 Django Basic Apps),使用 simple has_previous and has_next
我复制了 django.contrib.cmets 并尝试修改代码但没有成功。代码很难理解(django/contrib/cmets/templatetags/cmets.py),因为它由 Node 和 Parser 组成
这是我用于博客应用程序的 cmets.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 模板标签:)
提前致谢
【问题讨论】:
标签: django django-templates comments pagination templatetags