Chronologue

25 March 2009

Bookmark No comments

Django NamePaginator snippet

Here’s a very cool pagination snippet that allows you to create an alphabetical list of objects like: Browse by title: A-G | H-N | O-Z. NamePaginator works almost exactly like Django’s Paginator: you pass in a list of objects and how many you want per letter range and it dynamically generates the pages so that there are approximately that many objects per page. I wish this were a full-fledged app, like django-pagination, with all the features of that app, but this is a great start and a very useful bit of functionality.

www.djangosnippets.org/snippets/1364/