Last active
June 11, 2020 14:22
-
-
Save andytwoods/30e368b930a7bfbfc3115dc376883769 to your computer and use it in GitHub Desktop.
django bootstrap 4 pagination using fontawesome 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if is_paginated %} | |
<div class="col-12 text-center mx-auto "> | |
<div class="btn-group text-center" role="group"> | |
<a class='btn btn-secondary' | |
{% if page_obj.has_previous %}href="?page={{ page_obj.previous_page_number }}" | |
{% else %} disabled | |
{% endif %}> | |
<i class="fal fa-angle-double-left"></i> | |
</a> | |
{% for i in paginator.page_range %} | |
{% if page_obj.number == i %} | |
<span class="sr-only">(current)</span> | |
<a class="btn btn-primary font-weight-light" disabled>current page: {{ i }}</a> | |
{% else %} | |
<a class="btn btn-secondary font-weight-light small" href="?page={{ i }}">{{ i }}</a> | |
{% endif %} | |
{% endfor %} | |
<a class="btn btn-secondary" | |
{% if page_obj.has_next %}href="?page={{ page_obj.next_page_number }}" | |
{% else %} | |
disabled | |
{% endif %}> | |
<i class="fal fa-angle-double-right"></i> | |
</a> | |
</div> | |
</div> | |
{% endif %} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment