correct bump order for board page
This commit is contained in:
parent
4c7dd44815
commit
d81e709827
@ -18,21 +18,8 @@ class BoardView(generic.View):
|
|||||||
raise Http404("no such board")
|
raise Http404("no such board")
|
||||||
else:
|
else:
|
||||||
begin = page * group.posts_per_page
|
begin = page * group.posts_per_page
|
||||||
end = begin + group.posts_per_page
|
end = begin + group.posts_per_page - 1
|
||||||
print(begin, end)
|
roots = self.model.objects.filter(newsgroup=group, reference='').order_by('-last_bumped')[begin:end]
|
||||||
posts = self.model.objects.filter(newsgroup=group).order_by('-posted')[begin:end]
|
|
||||||
roots = []
|
|
||||||
for post in posts:
|
|
||||||
if post.is_op():
|
|
||||||
if post not in roots:
|
|
||||||
roots.append(post)
|
|
||||||
else:
|
|
||||||
op = self.model.objects.filter(msgid=post.reference)
|
|
||||||
if len(op) > 0:
|
|
||||||
op = op[0]
|
|
||||||
if op not in roots:
|
|
||||||
roots.append(op)
|
|
||||||
|
|
||||||
ctx = {'threads': roots,'page': page, 'name': newsgroup}
|
ctx = {'threads': roots,'page': page, 'name': newsgroup}
|
||||||
if page < group.max_pages:
|
if page < group.max_pages:
|
||||||
ctx['nextpage'] = '/{}/{}/'.format(group.name, page + 1)
|
ctx['nextpage'] = '/{}/{}/'.format(group.name, page + 1)
|
||||||
|
Reference in New Issue
Block a user