#29589: Insert a new method part_page_range for class Page in
django.core.paginator.py
----------------------------------------+------------------------
Reporter: BobDu | Owner: nobody
Type: New feature | Status: new
Component: Core (Other) | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------+------------------------
Class `Pagination` have a attribute `page_range`,
it's very useful when I want to write the other page link in the html.
We only need write in html like
{{{
<!-- contacts is a instance of Page class -->
{% for p in contacts.paginator.page_range %}
<li>
<a href="{% url 'admin_user_index' %}?&page={{ p }}">
{{ p }}
</a>
</li>
{% endfor %}
}}}
But, when the pages is too more, for example 1000, Things are going to get
scary.
So, I suggest insert a method `part_page_range()` for class Page.
For example,
When the `contacts.paginator.num_pages` `=1000`,
and the `contacts.number` `=500`,
I can use the
{{{
contacts.part_page_range(5)
}}}
to acquire a range instance `range(498, 503)`.
I think Django will be more handy after insert this method.
--
Ticket URL: <https://code.djangoproject.com/ticket/29589>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/049.3127cf080e1b596810283eee1b99ebce%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.