0
Django Endless Pagination 템플릿 상속을 사용할 때까지 완벽하게 올바르게 작동합니다.템플릿 상속을 사용할 때 Django-endless-pagination이 실패 함
views.py :
from django.shortcuts import render
def home(request):
objects = range(30)
return render(request,
'index.html',
locals()
)
index.html을 :
{% extends "root.html" %}
{% load endless %}
{% paginate objects %}
{% block content %}
{{ objects }}
<br/>
<br/>
{% show_pages %}
{% endblock %}
root.html : 나는 그것을 작동 index.html을의 라인 {% extends "root.html" %}
주석을 제거하면
<div class="content">
{% block content %}{% endblock %}
</div>
. 그렇지 않으면 나는 다음과 같은 오류가 발생합니다 :
Error during template rendering
In template /Users/tuk/Desktop/endlesstest/templates/index.html, error at line 10
Cannot find endless page in context.
1 {% extends "root.html" %}
2
3 {% load endless %}
4
5 {% paginate objects %}
6 {% block content %}
7 {{ objects }}
8 <br/>
9 <br/>
10 {% show_pages %}
11 {% endblock %}
그게 좋았어, 정말 고마워! 나는'무한 무부하'와'paginate objects' 태그를 블록으로 옮겼다. – tiktuk
아, 실제로는 {% 페이지 매김 객체 %}만이 블록에 있어야합니다. – tiktuk
예, 블록 밖의 모든 것은 템플릿 파일에없는 것과 같습니다. 다른 템플릿으로 확장 될 때입니다. – Goin