开发者

How to autopaginate this in Django

开发者 https://www.devze.com 2023-02-06 22:57 出处:网络
Hey, dudes i wanna paginate some categories, but when i use autopaginate it always give me a TemplateError. Here is the code that i wanna paginate

Hey, dudes i wanna paginate some categories, but when i use autopaginate it always give me a TemplateError. Here is the code that i wanna paginate

<!-- red 1 -->
            {% for tpl in cats %}
            <div class="clear Vraz10"></div>
     开发者_如何学C       <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>

I wanna paginate the categories, but i can't ;s And i'm asking for your help :}


It might be possible that you use {% autopaginate %} tag inside of block. Move it out of the {% block %} tag if this is the case.

Everything else can be left as is, just the autopaginate tag doesn't work inside of blocks. It doesn't generate any content so it doesn't matter where you put it.

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

{% autopaginate .... %}

... other stuff ...
0

精彩评论

暂无评论...
验证码 换一张
取 消