Skip to content

Instantly share code, notes, and snippets.

@walteranyika
Last active November 10, 2023 05:07
Show Gist options
  • Save walteranyika/0fdd30eab7676143e27c3c1c17c45df6 to your computer and use it in GitHub Desktop.
Save walteranyika/0fdd30eab7676143e27c3c1c17c45df6 to your computer and use it in GitHub Desktop.
Navigation for paginated results
<nav aria-label="Page navigation example">
<ul class="pagination justify-content-center">
{% if employees.has_previous %}
<li class="page-item">
<a class="page-link" href='?page={{ employees.previous_page_number }}'>Previous</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href='' tabindex="-1" aria-disabled="True">Previous</a>
</li>
{% endif %}
{% if employees.has_next %}
<li class="page-item">
<a class="page-link" href='?page={{ employees.next_page_number }}'>Next</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href='' tabindex="-1" aria-disabled="True">Next</a>
</li>
{% endif %}
</ul>
</nav>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment