From cb487f231efbf6dfb71f24977a002c5534b71198 Mon Sep 17 00:00:00 2001 From: iou1name Date: Mon, 24 Sep 2018 13:57:50 -0400 Subject: [PATCH] change check to base on Pages not Posts --- quest/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/quest/views.py b/quest/views.py index a208918..8087e59 100644 --- a/quest/views.py +++ b/quest/views.py @@ -21,11 +21,11 @@ def quest(request, quest_id, page_num=1): """ quest = Quest.objects.get(id=quest_id) pages = PageTitle.objects.filter(quest=quest).order_by('page_num') - messages = quest.message_set.all() - posts = quest.post_set.filter(page_num=page_num) - if posts.count() == 0: + if page_num > pages.reverse()[0].page_num: page_num = pages.reverse()[0].page_num return redirect('quest:quest', quest_id=quest.id, page_num=page_num) + messages = quest.message_set.all() + posts = quest.post_set.filter(page_num=page_num) # TODO: filter by page_num as well dice_rolls = DiceRoll.objects.filter(dicecall__post__quest=quest) poll_options = PollOption.objects.filter(poll__post__quest=quest)