2011-01-27 42 views
0

嘿,我想分頁分類,但是當我使用autopaginate時,它總是給我一個TemplateError。下面是我想分頁如何在Django中自動挑戰

<!-- red 1 --> 
      {% for tpl in cats %} 
      <div class="clear Vraz10"></div> 
      <div class="clear"> 
       {% for cat in tpl %} 
       <div class="left BoxNapravlenie" onclick="location.href='{{ cat.get_absolute_url }}';"> 
        <div class="left"><img src="{% if cat.icon %}{{ cat.icon.url }}{% else %}/media/images/napravlenia/love.gif{% endif %}" style="margin-top: 1px; margin-left: 1px;" title="{{ cat.cms_articles.count }} {% trans "articles" %}" /></div> 
        <div class="left BoxNapravlenieText">{{ cat }}</div> 
       </div> 
       <div class="left razdelitel2"><img src="/media/images/blank.gif" width="35" height="1" /></div> 
       {% endfor %} 
      </div> 
      {% endfor %} 
      <div class="clear Vraz10"></div> 
      <div class="OtherSection" onClick="location.href='{{ gencat.get_absolute_url }}';">{{ gencat }}</div> 
      <div class="clear Vraz10"></div> 

我想分頁的類別代碼,但我不能,S和我要求你的幫助:}

+0

你目前使用的是什麼分頁代碼/插件/應用程序? Django核心分頁? django_pagination應用程序?如果你讓我們知道一些細節,我們將能夠幫助更多 – 2011-01-27 22:00:46

回答

0

您使用{可能可以塊內的%autopaginate%}標記。如果是這種情況,請將其移出{%block%}標記。

其他所有內容都可以保持原樣,只是autopaginate標記在塊內不起作用。它不會生成任何內容,因此放在哪裏並不重要。

{% extends ... %} 
{% load pagination_tags %} 

{% autopaginate .... %} 

... other stuff ...