2👍
✅
Nothing shows up because Django doesn’t know what paginator
is, in the view template.
Looking at the example in the documentation, it seems you need to replace paginator
in the view with tasks
–
<div class="pagination">
<ul>
{% if tasks.has_previous %}
<li><a href="?page={{ tasks.previous_page_number }}">Previous</a></li>
{% endif %}
{% for pg in tasks.page_range %}
{% if posts.number == pg %}
<li class="active"><a href="?page={{ pg }}">{{ pg }}</a></li>
{% else %}
<li><a href="?page={{ pg }}">{{ pg }}</a></li>
{% endif %}
{% endfor %}
{% if tasks.has_next %}
<li><a href="?page={{ tasks.next_page_number }}">Next</a></li>
{% endif %}
</ul>
</div>
Source:stackexchange.com