{% if page_obj.num_pages != 1 -%} {% for page_id in page_obj.iter_pages() %} {{- page_id -}} {% endfor %} {%- endif %}