I’m new to Django. I’m using the simple pagination that Django provides but I need to paginate pages like this:
Prev 1 2 3 4 5 6 … 320
Or
Prev 120 121 122 123 Last
There are some code ready to reuse in Django 1.3 to achieve this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Let’s supose we have a view:
where pg is the page number you are looking at this moment. Then we need a bit of code to get queryset (or objects) and create paginator object:
Well, that you need to get:
is send to template a list like pags:
now send pags to your template. And render to something like:
for
the solution is the same. Decorate a little with css and you get it.
Also, for example, you can assign a class for current page in order to get it in bold style: