#2093 closed enhancement (duplicate)
[patch] Better paginator
Reported by: | Chris Beaven | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | minor | Keywords: | paginator patch |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There's no orhpan feature for the paginator. For example:
22 records, num_per_page=10, orphan=2 --> pages==2, len(self.get_page(1))==12
The paginator should work with lists too.
The patch fixes these and also provides more accurate validation.
Attachments (3)
Change History (9)
by , 19 years ago
Attachment: | better_paginator.patch added |
---|
comment:1 by , 19 years ago
Type: | defect → enhancement |
---|
comment:2 by , 19 years ago
by , 19 years ago
Attachment: | better_paginator_with_paginator_page_addition.patch added |
---|
PaginatorPage object - page aware ObjectPaginator wrapper
comment:3 by , 18 years ago
Component: | Admin interface → Core framework |
---|---|
Keywords: | paginator patch added |
I like the patch. I haven't tested it, but by looking at the code it does seem to improve upon what's already there. In addition, it addresses my enhancement ticket #2352.
Though, I am not sure the PaginatorPage class would be necessary.
comment:4 by , 18 years ago
It's definately not necessary and is a seperate enhancement, but I have found it useful.
When you have a batch of objects, it is a lot easier dealing with a PaginatorPage object than a Paginator object in the template. I mean why should the template have to know which page it's on when getting the correct batch? It shouldn't - therefore this helps keep that logic in the view while still providing all the useful Paginator methods to the template author.
by , 18 years ago
Attachment: | better_paginator_with_paginator_page_addition.2.patch added |
---|
comment:5 by , 18 years ago
Could you split this up into two patches please and move the new functionality (the PaginatorPage class) to a new ticket. I am not too enthused (at least, not yet) about the PaginatorPage without it undergoing a bit more work, but the orphan/widow stuff looks pretty straightforward. It's just hard to address two completely separate features in one ticket (the fact that they both talk about pagination is just a coincidence). So if you could split it up and move part of it to a new ticket, then we can handle each part separately.
comment:6 by , 18 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
I have another useful addition to this patch, up to the Django developers whether it should be added.
better_paginator.patch
is still fine, this new one has those enhancements + a new object inpaginator.py
:So it's just a page aware paginator object wrapper.
For example, if you have a paginator object in a view, you can set up a PaginatorPage object (passing the paginator and current page number) and then pass this object directly to your template.