안녕하세요 답변 페이징 도움 요청합니다.

안녕하세요 죄송하지만 혹시 question_detail부분 소스코드를 보여주실 수 있을까요? 게시판에 답변페이징관련해서 답변달아 주신것으로 base_views부분도 수정하고 여러가지 계속 해보는데도 작동이 안되네요 ㅠ 제 소스코드도 첨부하겠습니다.
현재 형태만 나오고 아무런 작동도 되지 않는 상황입니다. 답변이 10개씩 잘리지 않아서 페이징도 안되고있고 정렬도 안됩니다.

question.detail

{% extends 'base.html' %}
{% load pybo_filter %}
{% block content %}
<div class="container my-3">
    <!-- 사용자 오류 표시 -->
    {% if messages %}
    <div class="alert alert=danger my-3" role="alert">
    {% for message in messages %}
        <strong>{{ message.tags }}</strong>
        <ul><li>{{ message.message }}</li></ul>
    {% endfor %}
    </div>
    {% endif %}
    <h2 class="border-bottom py-2">{{ question.subject }}</h2>
    <div class="row my-3">
        <div class="col-1"> <!-- 추천 영역 -->
            <div class="bg-light text-center p-3 border font-weight-bolder mb-1">
                {{ question.voter.count }}
            </div>
            <a href="#" data-uri="{% url 'pybo:vote_question' question.id %}"
               class="recommend btn btn-sm btn-secondary btn-block my-1">추천</a>
        </div>
        <div class="col-11"> <!-- 질문 영역 -->
            <div class="card">
                <div class="card-body">
                    <div class="card-text">
                        {{ question.content|mark }}
                    </div>
                    <div class="d-flex justify-content-end">
                        {% if question.modify_date %}
                        <div class="badge badge-light p-2 text-left mx-3">
                            <div class="mb-2">modified at</div>
                            <div>{{ question.modify_date }}</div>
                        </div>
                        {% endif %}
                        <div class="badge badge-light p-2 text-left">
                            <div class="mb-2">{{ question.author.username }}</div>
                            <div>{{ question.create_date }}</div>
                        </div>
                    </div>
                    {% if request.user == question.author %}
                    <div class="my-3">
                        <a href="{% url 'pybo:question_modify' question.id %}"
                           class="btn btn-sm btn-outline-secondary">수정</a>
                        <a href="#" class="delete btn btn-sm btn-outline-secondary"
                           data-uri="{% url 'pybo:question_delete' question.id %}">삭제</a>
                    </div>
                    {% endif %}
                    <!-- 질문 댓글 Start -->
                    {% if question.comment_set.count > 0 %}
                    <div class="mt-3">
                    {% for comment in question.comment_set.all %}
                        <a name="comment_{{ comment.id }}"></a>
                        <div class="comment py-2 text-muted">
                            <span style="white-space: pre-line;">{{ comment.content }}</span>
                            <span>
                                - {{ comment.author }}, {{ comment.create_date }}
                                {% if comment.modify_date %}
                                (수정:{{ comment.modify_date }})
                                {% endif %}
                            </span>
                            {% if request.user == comment.author %}
                            <a href="{% url 'pybo:comment_modify_question' comment.id %}"
                               class="small">수정</a>,
                            <a href="#" class="small delete"
                               data-uri="{% url 'pybo:comment_delete_question' comment.id %}">삭제</a>
                            {% endif %}
                        </div>
                    {% endfor %}
                    </div>
                    {% endif %}
                    <div>
                        <a href="{% url 'pybo:comment_create_question' question.id %}"
                        class="small"><small>댓글 추가 ..</small></a>
                    </div>
                    <!-- 질문 댓글 End -->
                </div>
            </div>
        </div>
    </div>
    <h5 class="border-bottom my-3 py-2">
        {{question.answer_set.count}}개의 답변이 있습니다.
    </h5>
    <div class="col-2">
        <select class="form-control so">
            <option value="recent" {% if so == 'recent' %}selected{% endif %}>최신순</option>
            <option value="recommend" {% if so == 'recommend' %}selected{% endif %}>추천순</option>
        </select>
    </div>
    {% for answer in question.answer_set.all %}
    <div class="row my-3">
        <div class="col-1"> <!-- 추천 영역 -->
            <div class="bg-light text-center p-3 border font-weight-bolder mb-1">
                {{ answer.voter.count }}
            </div>
            <a href="#" data-uri="{% url 'pybo:vote_answer' answer.id %}"
               class="recommend btn btn-sm btn-secondary btn-block my-1">추천</a>
        </div>
        <div class="col-11"> <!-- 답변 영역 -->
            <div class="card">
                <div class="card-body">
                    <div class="card-text">
                        {{ answer.content|mark }}
                    </div>
                    <div class="d-flex justify-content-end">
                        {% if answer.modify_date %}
                        <div class="badge badge-light p-2 text-left mx-3">
                            <div class="mb-2">modified at</div>
                            <div>{{ answer.modify_date }}</div>
                        </div>
                        {% endif %}
                        <div class="badge badge-light p-2 text-left">
                            <div class="mb-2">{{ answer.author.username }}</div>
                            <div>{{ answer.create_date }}</div>
                        </div>
                    </div>
                    {% if request.user == answer.author %}
                    <div class="my-3">
                        <a href="{% url 'pybo:answer_modify' answer.id %}"
                           class="btn btn-sm btn-outline-secondary">수정</a>
                        <a href="#" class="delete btn btn-sm btn-outline-secondary"
                           data-uri="{% url 'pybo:answer_delete' answer.id %}">삭제</a>
                    </div>
                    {% endif %}
                    <!-- 답변 댓글 Start -->
                    {% if answer.comment_set.count > 0 %}
                    <div class="mt-3">
                    {% for comment in answer.comment_set.all %}
                        <a name="comment_{{ comment.id }}"></a>
                        <div class="comment py-2 text-muted">
                            <span style="white-space: pre-line;">{{ comment.content }}</span>
                            <span>
                                - {{ comment.author }}, {{ comment.create_date }}
                                {% if comment.modify_date %}
                                (수정:{{ comment.modify_date }})
                                {% endif %}
                            </span>
                            {% if request.user == comment.author %}
                            <a href="{% url 'pybo:comment_modify_answer' comment.id %}"
                               class="small">수정</a>,
                            <a href="#" class="small delete"
                               data-uri="{% url 'pybo:comment_delete_answer' comment.id %}">
                                삭제
                            </a>
                            {% endif %}
                        </div>
                    {% endfor %}
                    </div>
                    {% endif %}
                    <div>
                        <a href="{% url 'pybo:comment_create_answer' answer.id %}"
                           class="small"><small>댓글 추가 ..</small></a>
                    </div>
                    <!-- 답변 댓글 End -->
                </div>
            </div>
        </div>
    </div>
    {% endfor %}
    <!-- 페이징 처리 시작 -->
    <ul class="pagination justify-content-center">
        <!-- 처음 페이지 -->
        <li class="page-item">
            <a class="page-link" data-page="1" href="#">처음</a>
        </li>
        <!-- 이전 페이지 -->
        {% if answer_set.has_previous %}
        <li class="page-item">
            <a class="page-link" data-page="{{ answer_set.previous_page_number }}" href="#">이전</a>
        </li>
        {% else %}
        <li class="page-item disabled">
            <a class="page-link" tabindex="-1" aria-disabled="true" href="#">이전</a>
        </li>
        {% endif %}
        <!-- 페이지 리스트 -->
        {% for page_number in answer_set.paginator.page_range %}
            {% if page_number >= answer_set.number|add:-4 and page_number <= answer_set.number|add:4 %}
                {% if page_number == answer_set.number %}
                <li class="page-item active" aria-current="page">
                    <a class="page-link" data-page="{{ page_number }}" href="#">{{ page_number }}</a>
                </li>
                {% else %}
                <li class="page-item">
                    <a class="page-link" data-page="{{ page_number }}" href="#">{{ page_number }}</a>
                </li>
                {% endif %}
            {% endif %}
        {% endfor %}
        <!-- 다음 페이지 -->
        {% if answer_set.has_next %}
        <li class="page-item">
             <a class="page-link" data-page="{{ answer_set.next_page_number }}" href="#">다음</a>
        </li>
        {% else %}
        <li class="page-item disabled">
            <a class="page-link" tabindex="-1" aria-disabled="true" href="#">다음</a>
        </li>
        {% endif %}
    </ul>
    <!-- 페이징 처리 끝 -->
    <form action="{% url 'pybo:answer_create' question.id %}" method="post" class="my-3">
        {% csrf_token %}
        {% if form.errors %}
            <div class="alert alert-danger" role="alert">
            {% for field in form %}
                {% if field.errors %}
                <strong>{{ field.label }}</strong>
                {{ field.errors}}
                {% endif %}
            {% endfor %}
            </div>
        {% endif %}
        <div class="form-group">
            <textarea name="content" id="content"
                      {% if not user.is_authenticated %}disabled{% endif %}
                      class="form-control" rows="10"></textarea>
        </div>
        <input type="submit" value="답변 등록" class="btn btn-primary">
    </form>
</div>
<form id="searchForm" method="get" action="{% url 'pybo:detail' question.id %}">
    <input type="hidden" id="page" name="page" value="{{ page }}">
    <input type="hidden" id="so" name="so" value="{{ so }}">
</form>
{% endblock %}
{% block script %}
<script type='text/javascript'>
$(document).ready(function(){
    $(".delete").on('click', function() {
        if(confirm("정말로 삭제하시겠습니까?")) {
            location.href = $(this).data('uri');
        }
    });
    $(".recommend").on('click', function() {
        if(confirm("정말로 추천하시겠습니까?")) {
            location.href = $(this).data('uri');
        }
    });
    $(".page-link").on('click', function() {
        $("#page").val($(this).data("page"));
        $("#searchForm").submit();
    });
    $(".so").on('change', function() {
        $("#so").val($(this).val());
        $("#page").val(1);
        $("#searchForm").submit();
    });
});
</script>
{% endblock %}

dldldl0039 533

M 2022년 6월 20일 7:22 오후

목록으로
1개의 답변이 있습니다. 1 / 1 Page

{% for answer in question.answer_set.all %}

를 다음처럼 바꾸어 보세요.

{% for answer in answer_list %}

박응용

2022년 6월 20일 5:22 오후

와 정말정말 감사합니다 !!!!!!!!!!!!!!!!!!!!!!ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ - dldldl0039님, 2022년 6월 20일 7:41 오후 추천 , 대댓글