I want to iterate a list and query set in my html render, but am unable to get the Django paginator to work. I zipped the list and queryset so I could iterate them together. Here's my views.py code.
Oddly enough, I am able to access the data in both lists with {% for item1, item2 in posts %}, but {{ posts.next_page_number }} is just blank. How can I access the page in the templating engine?
CodePudding user response:
Your item2
is the Page
object as you zipped it second. So presumably you would do it as follows…
{{ item2.next_page_number }}