Fixed pagination
This commit is contained in:
parent
7af20c15e9
commit
ffc4c802cb
1 changed files with 4 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
import os
|
import os
|
||||||
|
from math import ceil
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from werkzeug import parse_date
|
from werkzeug import parse_date
|
||||||
from jinja2.utils import urlize
|
from jinja2.utils import urlize
|
||||||
|
|
@ -83,8 +84,9 @@ def archive(page):
|
||||||
threads = all_threads[offset:offset + config.THREADS_PER_PAGE]
|
threads = all_threads[offset:offset + config.THREADS_PER_PAGE]
|
||||||
if page != 1 and not threads:
|
if page != 1 and not threads:
|
||||||
abort(404)
|
abort(404)
|
||||||
return render_template('mailinglist/archive.html', page_count=
|
return render_template('mailinglist/archive.html',
|
||||||
len(threads) // config.THREADS_PER_PAGE + 1,
|
page_count=int(ceil(threads /
|
||||||
|
float(config.THREADS_PER_PAGE))),
|
||||||
page=page, threads=threads)
|
page=page, threads=threads)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue