pagination - How do I only query paginated data in django? - Stack Overflow

I have successfully paginated when returning all the objects but however, when I query the return for t

I have successfully paginated when returning all the objects but however, when I query the return for the searched result, it initially gets the correct pagination number of page. But clicking on any of the paginated searched result will immediately return the pagination of all the objects.

My HTML pagination

<ul class="pagination center" id="pagination" hx-swap-oob="true">
  {% if data.has_previous %}
  <li class="waves-effect">
    <a href="?page={{ data.previous_page_number }}"><i class="material-icons"><</i></a>
  </li>
  {% endif %} {% for page in data.paginator.page_range %} {% if page == data.number %}
  <li class="active purple lighten-2"><a href="?page={{ page }}">{{page}}</a></li>
  {% else %}
  <li class="waves-effect"><a href="?page={{ page }}">{{page}}</a></li>
  {% endif %} {% endfor %} {% if data.has_next %}
  <li class="waves-effect">
    <a href="?page={{data.next_page_number}}"><i class="material-icons">></i></a>
  </li>
  {% endif %}
</ul>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744862052a4597761.html

相关推荐

  • pagination - How do I only query paginated data in django? - Stack Overflow

    I have successfully paginated when returning all the objects but however, when I query the return for t

    2天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信