#27814: Unclear explanation of orphans in Paginator
-------------------------------------+-------------------------------------
Reporter: Pablo | Owner: nobody
OubiƱa |
Type: | Status: new
Uncategorized |
Component: | Version: 1.10
Documentation |
Severity: Normal | Keywords: paginator, orphans,
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Hi there!
From [https://docs.djangoproject.com/en/1.10/topics/pagination/#optional-
arguments/ Django documentation]:
''"**Paginator** objects
...
**orphans**
The minimum number of items allowed on the last page, defaults to
zero..."''
Current implementation:
{{{
>>> from django.core.paginator import Paginator
>>> objects = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
>>> p = Paginator(objects, 3, orphans=2)
>>> page2 = p.page(2)
>>> page2.object_list
output: ['d', 'e', 'f', 'g', 'h']
>>> page2.has_next()
output: False
}}}
As I understand it:
{{{
>>> from django.core.paginator import Paginator
>>> objects = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']
>>> p = Paginator(objects, 3, orphans=2)
>>> page2 = p.page(2)
>>> page2.object_list
output: ['d', 'e', 'f']
>>> page2.has_next()
output: True
>>> page3 = p.page(3)
>>> page3.object_list
output: ['g', 'h']
}}}
In my opinion, the **''orphans''** definition is confusing. What do you
think? Am I missing something?
Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/27814>
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.1e32d1a176eaa30f24fd30b99cfd8561%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.