That's math!
e.g.
records_per_page = 10 records
all_records = 137 records

pages_needed = all_records / records_per_page (division)
last_page = all_records % records_per_page (module)

that is 13 "full pages" + 1 page with 7 records.

So, you'll have to count the total of your records, divide it by the number 
of "records per page" , an voila.

If you want urls in the form of (/myapp/mycontroller/myfunction/1, 
/myapp/mycontroller/myfunction/2, /myapp/mycontroller/myfunction/3, etc) it 
would roughly translate to:

all_records = 137
records_per_page = 10
urls = [URL('myapp', 'mycontroller', 'myfunction', args=[page+1]) for page 
in range(all_records+1)]



On Monday, July 23, 2012 10:20:48 PM UTC+2, adohertyd wrote:
>
> I have an application that returns a list of between 50-100 items. I have 
> no database layer it isn't required for my app. I want to display 10 of 
> those items on a page, and only generate the number of pages needed to view 
> those results. Can anyone point me in the right direction (not the docs, 
> they don't make any sense to me for this problem). Thank you

-- 



Reply via email to