0

django cmsページでdjangoエンドレスページネーションを表示するにはどうすればよいですか? 現在、テンプレート タグを使用してコンテンツ (画像) をレンダリングしています。テンプレートタグにページネーションコードを書くことはできますか?私のcmsテンプレートは次のとおりです。

    {% extends 'base.html' %}
{% load cms_tags sekizai_tags instagram_images media_list %}
{% block title %}Home{% endblock %}
{% block main_content %}
<section class="bigBanner clearfix">
    <div class="container "> </div>
</section>
</div>
</section>
<hgroup class="title">
    <div class="container ">
        <h1>Videos</h1>
    </div>
</hgroup>
<section class="clearfix content innerPage galleyPage">
    {% get_video_gallery %}
    <hgroup class="title">
        <div class="container ">
            <h1>Images</h1>
        </div>
    </hgroup>
    <div class="container">
        {% get_photo_gallery %}
    </div>
</section>
{% endblock %} 

私のget_photo_galleryテンプレートタグは次のとおりです。

@register.inclusion_tag('cms/templatetags/image_gallery.html')
def get_photo_gallery():
    try:
        images = Images.objects.all()
    except:
        images = None
    return {'images':images}

私のimage_gallery.htmlは次のとおりです。

<div class="imageSelector">
    Select a category :‭ ‬&lt;select name="" class="selector">
      <option>Events</option>
      <option>Events</option>
      <option>Events</option>
      <option class="last">Events</option>
    </select><input name="GO" type="submit" class="goBtn" id="GO" value="GO" />
  </div>

{% for image in images %}
{% if forloop.counter|add:"-1"|divisibleby:"3" %}
    <div class="clearfix row-fluid">
 {% endif %}
      <div class="span4">
        <a class="gallery" href="{{ image.image.url }}" {% if LANGUAGE_BIDI %} title="{{ image.description_ar }}" {% else %} title="{{ image.description }}" {% endif %}>
           <img src="{{ image.image.url }}" width="370 px" height="302px" alt="" /></a>
        {% if LANGUAGE_BIDI %}
            <p>{{ image.description_ar|truncatechars:17|safe }}</p>
            {% else %}
             <p>{{ image.description|truncatechars:17|safe }}</p>
            {% endif %}
      </div>
  {% if forloop.counter|divisibleby:"3" %}
       </div>
        {% endif %}
 {% endfor %}

私が実際に表示したいのは、Twitter スタイルのページネーションです。ビューの変更が必要であり、cms ページ テンプレートはビューを使用してレンダリングされません。

4

1 に答える 1

1

http://django-endless-pagination.readthedocs.org/en/latest/index.htmlをご覧ください。

于 2013-05-29T11:07:13.327 に答える