점프투장고 03-2에서 페이지가 5내외로 나타나지 안습니다.

{% if page_number >= question_list.number|add:-5 and page_number <= question_list.number|add:5 %}
를 실행할려고 하는데 자꾸 TemplateSyntaxError at /pybo/ 가 뜨네요.

깃허브에 올려있는 코드와 비교를 해도 다른게 없는데 .... 이전까지는 작동이 됐거든요. 그런데 위 줄을 삽입하고 나서는 위와 같은 에러가 뜹니다. 뭐가 문제인지... 제 코드는 아래와 같습니다. 에러 이미지를 삽입할려고 하는데 그것도 안되네요...그래서 복사해서 아래에 붙여 넣습니다.

{% extends 'base.html' %}
{% block content %}
<div class="container my-3">
  <table class="table">
        <thead>
        <tr class="thead-azure">
            <th>Number</th>
            <th>Title</th>
            <th>Date</th>
        </tr>

        </thead>
        <tbody>
        {% if question_list %}
        {% for question in question_list %}
        <tr>
            <td>{{forloop.counter}}</td>
            <td>
                <a href="{% url 'pybo:detail' question.id %}">
                {{question.subject}}
                </a>
            </td>
            <td>{{question.create_date}}</td>
        </tr>
        {% endfor %}
        {% else %}
        <tr>
            <td colspan="3">No question any more</td>
        </tr>
        {% endif %}
        </tbody>
    </table>

    <ul class="pagination justify-content-cneter">
        {% if question_list.has_previous %}
        <li class="page-item">
            <a class="page-link" href="?page={{ question_list.prevous_page_number }}">
                Previous
            </a>
        </li>

        {% else %}
        <li class="page-item disabled">
            <a class="page-link" tabindex="-1" aria-disabled="true" href="#">
                Previous
            </a>
        </li>
        {% endif %}

<!--        Page List -->

        {% for page_number in question_list.paginator.page_range %}

        {% if page_number >= question_list.number|add:-5 and page_number <= question_list.number|add:5 %}

            {% if page_number == question_list.number %}
            <li class="page-item active" aria-current="page">
            <a class="page-link" href="?page={{page_number}}">

            </a>
        </li>

            {% else %}
        <li class="page-item">
            <a class="page-link" href="?page={{page_number}}">
                {{page_number}}
            </a>

        </li>

            {% endif %}

        { % endif %}
        <!--restrict page number in 5 from left to right one          -->

        {% endfor %}

<!--        Next page -->

        {% if question_list.has_next %}
        <li class="page-item">
            <a class="page-link" href="?page={{question_list.next_page_number}}">
                Next
            </a>
        </li>

        {% else %}
        <li class="page-item disabled">
            <a class="page-link" tabindex="-1" aria-disabled="true" href="#">
                Next
            </a>

        </li>
        {% endif %}
    </ul>

<!--    end of paging  -->

    <a href="{% url 'pybo:question_create' %}" class="btn btn-primary">

               Register Question
    </a>
</div>


{% endblock %}

-----에러메세지

TemplateSyntaxError at /pybo/
Invalid block tag on line 76: 'endfor', expected 'elif', 'else' or 'endif'. Did you forget to register or load this tag?
Request Method: GET
Request URL:    http://localhost:8000/pybo/?page=3
Django Version: 3.1.3
Exception Type: TemplateSyntaxError
Exception Value:    
Invalid block tag on line 76: 'endfor', expected 'elif', 'else' or 'endif'. Did you forget to register or load this tag?
Exception Location: F:\big7\django\jumptodjango\lib\site-packages\django\template\base.py, line 522, in invalid_block_tag
Python Executable:  F:\big7\django\jumptodjango\Scripts\python.exe
Python Version: 3.8.5
Python Path:    
['F:\\big7\\django',
 'C:\\Users\\wonnh\\AppData\\Local\\Programs\\Python\\Python38\\python38.zip',
 'C:\\Users\\wonnh\\AppData\\Local\\Programs\\Python\\Python38\\DLLs',
 'C:\\Users\\wonnh\\AppData\\Local\\Programs\\Python\\Python38\\lib',
 'C:\\Users\\wonnh\\AppData\\Local\\Programs\\Python\\Python38',
 'F:\\big7\\django\\jumptodjango',
 'F:\\big7\\django\\jumptodjango\\lib\\site-packages']
Server time:    Tue, 02 Mar 2021 08:39:30 +0000
Error during template rendering
In template F:\big7\django\templates\pybo\question_list.html, error at line 76

Invalid block tag on line 76: 'endfor', expected 'elif', 'else' or 'endif'. Did you forget to register or load this tag?
66                  {{page_number}}
67              </a>
68  
69          </li>
70  
71              {% endif %}
72  
73          { % endif %}
74          <!--restrict page number in 5 from left to right one          -->
75  
76          {% endfor %}
77  
78  <!--        Next page -->
79  
80          {% if question_list.has_next %}
81          <li class="page-item">
82              <a class="page-link" href="?page={{question_list.next_page_number}}">
83                  Next
84              </a>
85          </li>
86

최원호 2083

M 2021년 3월 2일 8:41 오후

+1 if와 endif 의 댓구가 맞아 보이는데... 이상하네요. 혹시 다음 URL의 소스로 바꾸어도 동일한 오류가 날까요? https://github.com/pahkey/djangobook/blob/3-02/templates/pybo/question_list.html - 박응용님, 2021년 3월 2일 8:52 오후 추천 , 대댓글
@박응용님 제대로 작동합니다. 뭐가 문제인지 확인해 보겠습니다.^^ - 최원호님, 2021년 3월 5일 9:12 오전 추천 , 대댓글
목록으로
1개의 답변이 있습니다. 1 / 1 Page

73번 라인에 { % endif %} 를
{% endif %} 요렇게 바꾸니 잘 됩니다

장고매니아

2021년 3월 5일 11:42 오후