python - Show fewer pages in Django pagination -
i working on django application , on 1 of pages use pagination. have around 200 pages , if somewhere in middle has links page 1 - 4, displays 4 pages behind page on, 3 after page on , last 4 pages. looking this
i shows fewer pages @ time, maybe first 2, last 2 , current page on +/- 2.
{% extends 'base.html' %} {% load pagination_tags %} {% load staticfiles %} {% block body_block %} {% autopaginate art 4 %} <div class="container"> {% if item%} {% x in item %} <div class="floated_img"> {% if x.picture %} <img src="{{ x.picture.url }}" name="aboutme" width="140" height="140" class="img-rounded" class="img-responsive"> {% else %} <img src="{% static "images/generic.jpg" %}" name="aboutme" width="140" height="140" class="img-rounded" class="img-responsive"> {% endif %} <div class="table-responsive"> <p style="text-align: center;"> <strong>{{ x.name }}</strong><br> <strong>{{ x.type }}</strong><br> <strong>{{ x.price }}</strong> </div> </p> </div> {% endfor %} <br> </div> {% endif %} <br> {% paginate %} {% endblock %}
i have not written python files pagination , have imported things in, assume have make changes of pagination files , store them within project override them don't know how go doing this.
would grateful , hope have given enough information problem
you seem using django-pagination app. has setting number of items left , right of current page
pagination_default_window
number of items left , right of current page display (accounting ellipses).
so setting
pagination_default_window = 2
would set middle part required.
Comments
Post a Comment