2011-01-27 3 views
0

안녕하세요, 일부 카테고리를 매김하고 싶습니다.하지만 자동 태그 매김을 사용하면 항상 나에게 TemplateError를줍니다. 여기에 내가 싶어장고에서 자동 자막을 만드는 방법

<!-- 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> 

이 카테고리 페이지를 매기는 페이지를 매기 싶어 코드입니다,하지만 난 할 수 없습니다;의 그리고 난 당신의 도움을 요청 해요 :}

+0

현재 사용중인 페이지 매기기 코드/플러그인/앱은 무엇입니까? 장고 코어 매김? django_pagination 앱은 무엇입니까? 좀 더 자세한 정보를 알려 주시면 더 많은 것을 도와 드리겠습니다. –

+0

"django.core.paginator에서 Paginator, InvalidPage, EmptyPage 가져 오기"에서 Django core paginator를 사용합니다.이 코드는 views.py에 있습니다. – UmriWe

+0

news.html에서 {% 자동 여백 결과 10 %} {% 페이지 매기기 %} – UmriWe

답변

0

당신이 {사용하는 것이 가능 수 있습니다 % autopaginate %} 태그 내부에 있습니다. 이 경우 {% block %} 태그 밖으로 이동하십시오.

나머지는 그대로 둘 수 있습니다. 자동 태그 추가 태그는 블록 내부에서 작동하지 않습니다. 콘텐츠를 생성하지 않으므로 콘텐츠를 어디에 두어도 상관 없습니다.

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

{% autopaginate .... %} 

... other stuff ... 
관련 문제