Opened 11 years ago

Closed 7 years ago

#6860 closed New feature (wontfix)

Improvements for the new paginator

Reported by: Alberto García Hierro <fiam@…> Owned by: nobody
Component: Core (Other) Version: master
Severity: Normal Keywords: paginator
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no


This patch adds methods for storing the base_url and retrieving it, displaying the page list as ul or div (taking the current page into account) as well as for obtaining the links for the previous and next pages. I've not included any documentation, because I want to get some feedback about the code itself before writing any doc.

Attachments (2)

0005-Improve-the-new-paginator.diff (6.1 KB) - added by Alberto García Hierro <fiam@…> 11 years ago.
0005-Improve-the-new-paginator.2.diff (5.9 KB) - added by Alberto García Hierro <fiam@…> 11 years ago.
Improved version of the patch

Download all attachments as: .zip

Change History (7)

Changed 11 years ago by Alberto García Hierro <fiam@…>

Changed 11 years ago by Alberto García Hierro <fiam@…>

Improved version of the patch

comment:1 Changed 10 years ago by Jeff Anderson

Needs documentation: set
Triage Stage: UnreviewedDesign decision needed

This looks useful, and would probably clean up views that use the paginator.
The patch applies beautifully to current trunk.

comment:3 Changed 8 years ago by Julien Phalip

Needs tests: set
Patch needs improvement: set

This seems useful but the patch is old and needs to be updated. Also needs tests.

comment:4 Changed 8 years ago by Julien Phalip

Severity: Normal
Type: New feature

comment:5 Changed 7 years ago by Carl Meyer

Easy pickings: unset
UI/UX: unset

Discussion with Alex: the PageList object hardcodes a bunch of HTML in Python strings, which is not ok. The page_or_404 method and the base_url, next url, previous url stuff break the conceptual boundary of the Paginator object, so it no longer just paginates a sequence of objects, but now also has (rudimentary) knowledge of how URLs are constructed to reach those objects.

These problems are solved more cleanly by third-party packages such as django-pagination, that wrap more sophisticated URL logic and display utilities around the core Paginator rather than extending it in a way that breaks its conceptual simplicity. And it makes sense to leave such packages outside core, because how page numbering is displayed and how pagination URLs are handled is a matter of preference that will vary between projects.

comment:6 Changed 7 years ago by Carl Meyer

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top