如何在django cms页面中显示django无尽的pagianation?目前我使用模板标签渲染我的内容(图像)。是否可以在模板标签中编写分页代码? 我的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 : <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风格的分页http://django-endless-pagination.readthedocs.org/en/latest/twitter_pagination.html。正常的分页是有效的,因为它的唯一模板更改为显示分页的页面。但是,twitter样式需要更改视图,而cms页面模板不会使用图。