Frage

Gibt es eine bestehende Paginierung Lösung für Django contrib.comments?

Was ich brauche nur ein einfacher paginierte django Kommentare, für die Basic-Blog-Anwendung (aus dem Django Grunde Apps) Ich verwenden, mit einem einfache has_previous und has_next

Ich habe den django.contrib.comments kopiert und versuchte, den Code zu ändern, aber ohne Erfolg. Der Code ist ziemlich hart (django / contrib / Kommentare / templatetags / comments.py) zu verstehen, denn sie besteht aus Knoten und Parser

Hier ist meine comments.html Vorlage ich für die Blog-Anwendung verwendet:

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

Ich denke, das Problem liegt in der get_comment_list templatetags:)

Vielen Dank im Voraus

War es hilfreich?

Lösung

Ich denke, django-Paginierung sein könnte, was Sie suchen.

http://code.google.com/p/django-pagination/ (Screencasts verfügbar)

Andere Tipps

Django auch in Paginierung System aufgebaut hat

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top