|
@@ -1,5 +1,6 @@
|
|
|
from math import ceil
|
|
|
|
|
|
+from django.conf import settings
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
|
|
from misago.readtracker.threadstracker import make_read_aware
|
|
@@ -12,24 +13,24 @@ def posts_queryset(qs):
|
|
|
|
|
|
|
|
|
def get_thread_pages(posts):
|
|
|
- if posts <= 13:
|
|
|
+ if posts <= settings.MISAGO_POSTS_PER_PAGE + settings.MISAGO_THREAD_TAIL:
|
|
|
return 1
|
|
|
|
|
|
- thread_pages = posts / 10
|
|
|
- thread_tail = posts - thread_pages * 10
|
|
|
- if thread_tail and thread_tail > 3:
|
|
|
+ thread_pages = posts / settings.MISAGO_POSTS_PER_PAGE
|
|
|
+ thread_tail = posts - thread_pages * settings.MISAGO_POSTS_PER_PAGE
|
|
|
+ if thread_tail and thread_tail > settings.MISAGO_THREAD_TAIL:
|
|
|
thread_pages += 1
|
|
|
return thread_pages
|
|
|
|
|
|
|
|
|
def get_post_page(posts, post_qs):
|
|
|
post_no = post_qs.count()
|
|
|
- if posts <= 13:
|
|
|
+ if posts <= settings.MISAGO_POSTS_PER_PAGE + settings.MISAGO_THREAD_TAIL:
|
|
|
return 1
|
|
|
|
|
|
thread_pages = get_thread_pages(posts)
|
|
|
|
|
|
- post_page = int(ceil(float(post_no) / 10))
|
|
|
+ post_page = int(ceil(float(post_no) / settings.MISAGO_POSTS_PER_PAGE))
|
|
|
if post_page > thread_pages:
|
|
|
post_page = thread_pages
|
|
|
return post_page
|