Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1353 (closed enhancement: fixed)

Opened 12 years ago

Last modified 12 years ago

[PATCH] to paginate.py to pass row_count, first and last item numbers to template

Reported by: chrismiles Owned by:
Priority: normal Milestone: 1.0.2
Component: unassigned Version: 1.0
Severity: normal Keywords:


I attach a patch with expands Paginate to add 3 useful attributes:

row_count - the total number of results that were returned by the query;

first_item - the index of the first item displayed on the current page;

last_item - the index of the last item displayed on the current page.

These new attributes make it possible to display this sort of information in the template:

"Displaying 1-10 of 15 items"

Using, for example, the following snippet of kid:

Displaying <span py:replace="tg.paginate.first_item">0</span>-<span py:replace="tg.paginate.last_item">0</span> of <span py:replace="tg.paginate.row_count">0</span> items

I couldn't find any other way to implement this, certainly without row_count being available in the template.


paginate_patch.diff Download (1.4 KB) - added by chrismiles 12 years ago.
Patches Paginate to add three useful attributes

Change History

Changed 12 years ago by chrismiles

Patches Paginate to add three useful attributes

comment:1 Changed 12 years ago by faide

  • Status changed from new to closed
  • Resolution set to fixed

Applied Thanks Chris!

Note: See TracTickets for help on using tickets.