2013-05-29 117 views
2

我如何顯示Django的cms頁面中的django無盡pagianation?目前我正在使用模板標記呈現我的內容(圖片)。是否可以在模板標籤中編寫分頁代碼? 我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 :‭ ‬<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頁面e模板不是使用視圖呈現的。

回答