Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
399 views
in Technique[技术] by (71.8m points)

html - Django el pagination limit number of pages in pagination

I've got small issue and I don't know how to fix it. I'm using Django EL(Endless) Pagination. I want to limit number of pages displayed. For now is like 40 and it doesn't look so good. How can I change this? Here is my html template fragment of pagination:

   {% paginate advertisements %}
    {% get_pages %}
<ul class="pagination" style="margin: auto;">
    {% if pages.paginated %}
    <nav aria-label="Blog pagination">
          <li class="page-item mr-3 {& if pages.previous.path == None %} disabled {% endif %}">
            <a class="page-link text-sm rounded" href="{{ pages.previous.path }}" aria-label="Poprzednia">
                <i class="fa fa-chevron-left mr-1"></i> Poprzednia</a></li>
              <span class="sr-only">Poprzednia</span>
            </a>
          </li>
          {% for page in pages %}
              <li class="page-item mr-3 {% if page.is_current %} active {% endif %}">
                <a class="page-link text-sm rounded" href="{{ page.path }}" aria-label="Page {{page.number}}">
                  {{page.number}}
                </a>
              </li>
          {% endfor %}
          <li class="page-item {% if pages.next.path == None %} disabled {% endif %}">
            <a class="page-link text-sm rounded" href="{{ pages.next.path }}" aria-label="Nast?pna">
                Nast?pna<i class="fa fa-chevron-right ml-1"></i></a></li>
              <span class="sr-only">Next</span>
    </nav>
</ul>
question from:https://stackoverflow.com/questions/66061670/django-el-pagination-limit-number-of-pages-in-pagination

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...