{% if page_obj.has_previous %} {% if search and q %} First {% else %} First {% endif %} {% endif %} {{ page_obj.number }} of {{ page_obj.paginator.num_pages }} {% if page_obj.has_next %} {% if search and q %} Last {% else %} Last {% endif %} {% endif %}