Reputation: 1983
How can i show django endless pagianation in a django cms page ? currently i am rendering my content(images) using template tag. Is it possible to write the pagination code in template tag ?. my cms template is:
{% 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 %}
and my get_photo_gallery template tag is:
@register.inclusion_tag('cms/templatetags/image_gallery.html')
def get_photo_gallery():
try:
images = Images.objects.all()
except:
images = None
return {'images':images}
my image_gallery.html is :
<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 %}
What i actually want to show is twitter style pagination http://django-endless-pagination.readthedocs.org/en/latest/twitter_pagination.html .The normal pagination works since its only template changes to show the paginated page.But twitter style requires changes in view and cms page template is not rendered using a view.
Upvotes: 0
Views: 644
Reputation: 2482
You might want to have a look at http://django-endless-pagination.readthedocs.org/en/latest/index.html
Upvotes: 1