{% if has_previous %} Previous {% endif %} {% if has_next %} Next page {% endif %}
    {% if show_first %}
  • 1
  • {% endif %} {% for num in page_numbers %} {% if forloop.first and num > 2 %}
  • …
  • {% endif %}
  • {{ num }}
  • {% if forloop.last and num < pages|add:"-1" %}
  • …
  • {% endif %} {% endfor %} {% if show_last %}
  • {{pages}}
  • {% endif %}