Jj Del Carpio

Jj's web stream

Using object_list generic view for pagination in Django

Whenever I want to display a list of items I'll need pagination, calculate first page, next page, total pages, current page, previous page, etc.

Although Django comes with pretty #topics-pagination">good pagination helpers, I've found that using the list_detail.object_list generic view hanles this very nicely :)

So whenever I want to display a list, I will return an object_list generic view instead of a HttpResponse object or a render_to_response call.

This came in pretty handy when helping Jason Broyles refactor some pagination code

Comments

#357574" title="2010-12-11 06:30:37">CursBnr: Hello; Charming post to me. Your send has good quality.

Jj Avatar of Jj

Reply or react to this post via Webmentions