sibtc / simple-infinite-scroll

Django Simple Infinite Scroll
https://simpleisbetterthancomplex.com/tutorial/2017/03/13/how-to-create-infinite-scroll-with-django.html
MIT License
35 stars 27 forks source link

Infinite scroll not working correctly in CBV #2

Open xicopetry opened 6 years ago

xicopetry commented 6 years ago

The pagination of articles are not working correctly.

The page seems not to be changing.

In the template, articles.html

  {% if page_obj.has_next %}
    <a class="infinite-more-link" href="?page={{ articles.next_page_number }}">More</a>
  {% endif %}

The correct is to take the page number from the page_obj.

Like this:

  {% if page_obj.has_next %}
    <a class="infinite-more-link" href="?page={{ page_obj.next_page_number }}">More</a>
  {% endif %}
GoodnessEzeokafor commented 5 years ago

did u still fix this??