{% if is_paginated|default:None %}

<nav aria-label="Page navigation example">
    <ul class="pagination">
        {% if page_obj.has_previous %}
            <li class="page-item"><a class="page-link" href="?page=1">First</a></li>
            <li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">&laquo;</a></li>
        {% else %}
            <li class="page-item disabled"><span class="page-link">&laquo;</span></li>
        {% endif %}
        {% for i in allowed_range %}
        {% if page_obj.number == i %}
        <li class=" page-item active"><span class="page-link">{{ i }} <span class="sr-only">(current)</span></span></li>
        {% else %}
        <li class="page-item"><a class="page-link" href="?page={{ i }}">{{ i }}</a></li>
        {% endif %}
        {% endfor %}
        {% if page_obj.has_next %}
            <li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">&raquo;</a></li>
            <li class="page-item"><a class="page-link" href="?page={{ page_obj.paginator.num_pages }}">Last</a></li>

        {% else %}
            <li class="page-item disabled"><span class="page-link">&raquo;</span></li>
        {% endif %}
    </ul>
</nav>
{% endif %}