Friday 15 July 2011

Expand pagination beyond previous, current, and next page (Django) -


I am using pagination on my page project and all this works well, but not me Know how to increase my reach +/- beyond, one page of the one I'm on. Currently, my HTML looks like this:

  & lt; Div class = "endorsement endorsement-centric" & gt; & Lt; Ul & gt; {% If title.has_previous%} & lt; Li & gt; & Lt; A href = "? Q = {{query}} and page = {{title.previous_page_number}}" & gt; A «& lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "? Q = {{query}} and page = {{title.previous_page_number}}" & gt; {{Title.previous_page_number}} & lt; / A & gt; & Lt; / Li & gt; {% Endif%} & lt; Li class = "active" & gt; & Lt; A href = "? Q = {{query}} and page = {{title.number}}" & gt; {{Title.number}} & lt; / A & gt; & Lt; / Li & gt; {% If title.has_next%} & lt; Li & gt; & Lt; A href = "? Q = {{query}} and page = {{title.next_page_number}}" & gt; {{Title.next_page_number}} & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "? Q = {{query}} and page = {{title.next_page_number}}" & gt; One »» » / A & gt; & Lt; / Li & gt; {% Endif%} & lt; / Ul & gt; & Lt; / Div & gt;   

There is something like [& lt; & Lt;, 1, 2 , 3, & gt; & Gt;] Looks like if you are on Page 2, I might want to extend reach of one or two steps or so. So if I am on page 3, then I can reach all the way from 1-5.

  {#} Create a button group to go to #} to include possible pages For page {paginator.page_range%}, click on the page% {page & lt; Toolbar_max and page & gt; Toolbar_min and page! = Results.number%} & lt; Button formation = "{% url 'quantity: page' page = page%}" & gt; {{Pages}} & lt; / Button & gt; {% Elif page == results.number%} & amp; Button type = "submit" formaction = "{% url 'version: page' page = page%}" & gt; {{Pages}} & lt; / Button & gt; {% Endif%} {% endfor%}   

In fact, you want to have a page with a minimum and maximum number (toolbar_man and toolbar_max and pass it on your page.

page menu toolbar_max = result.number + 4 toolbar_money = result.number-4

to pass the # variable so that it is the number given to you Displaying 4 on each side is currently a 'result' of my question which is present to the current page The Shit. I have a page I want to highlight a different CSS class, and to know that it should calculate the variables.

No comments:

Post a Comment