From d81e709827420239cd819295d0b2679bd4719be1 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 6 Nov 2016 11:01:04 -0500 Subject: [PATCH] correct bump order for board page --- .../django/nntpchan/nntpchan/frontend/views.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py b/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py index e452b8a..b48f205 100644 --- a/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py +++ b/contrib/frontends/django/nntpchan/nntpchan/frontend/views.py @@ -18,21 +18,8 @@ class BoardView(generic.View): raise Http404("no such board") else: begin = page * group.posts_per_page - end = begin + group.posts_per_page - print(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) - + end = begin + group.posts_per_page - 1 + roots = self.model.objects.filter(newsgroup=group, reference='').order_by('-last_bumped')[begin:end] ctx = {'threads': roots,'page': page, 'name': newsgroup} if page < group.max_pages: ctx['nextpage'] = '/{}/{}/'.format(group.name, page + 1)