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 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

This entry was posted in django, en, geek, programacion and tagged , . Bookmark the permalink.
  • Anonymous

    thanks for the info!

  • http://www.curs-bnr.net/ CursBnr

    Hello; Charming post to me. Your send has good quality.