diff options
author | Aamir Khan <syst3m.w0rm@gmail.com> | 2012-07-03 17:55:38 -0400 |
---|---|---|
committer | Aamir Khan <syst3m.w0rm@gmail.com> | 2012-07-03 17:55:38 -0400 |
commit | 3f53d3d1a46197047bba68bc5d283486f331830d (patch) | |
tree | f6e08cb74916575d6f244d9b90d38725b11bf458 | |
parent | 87989fee4680c0544e95cea00153b35609c51a92 (diff) | |
download | hyperkitty-3f53d3d1a46197047bba68bc5d283486f331830d.tar.gz hyperkitty-3f53d3d1a46197047bba68bc5d283486f331830d.tar.xz hyperkitty-3f53d3d1a46197047bba68bc5d283486f331830d.zip |
pagination for archives page
-rw-r--r-- | views/list.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/views/list.py b/views/list.py index b797db8..af68a01 100644 --- a/views/list.py +++ b/views/list.py @@ -32,9 +32,11 @@ MONTH_DISCUSSIONS = 82 -def archives(request, mlist_fqdn, year=None, month=None, day=None): +def archives(request, mlist_fqdn, year=None, month=None, day=None, pageNo=None): # No year/month: past 32 days # year and month: find the 32 days for that month + # @TODO : modify url.py to account for page number + end_date = None if year or month or day: try: @@ -82,7 +84,18 @@ def archives(request, mlist_fqdn, year=None, month=None, day=None): msg.thread_id) threads[cnt] = msg cnt = cnt + 1 - print msg + #print msg + + paginator = Paginator(threads, 10) + + try: + threads = paginator.page(pageNo) + except PageNotAnInteger: + # If page is not an integer, deliver first page. + threads = paginator.page(1) + except EmptyPage: + # If page is out of range (e.g. 9999), deliver last page of results. + threads = paginator.page(paginator.num_pages) archives_length = STORE.get_archives_length(list_name) |