From eea5be43231e30a56b54ec712dac3058d5efac40 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sun, 22 Jun 2014 15:14:06 +0000 Subject: [PATCH] Next/previous post links now omit drafts --- blog/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blog/views.py b/blog/views.py index 9ce7e27..cb27ee7 100644 --- a/blog/views.py +++ b/blog/views.py @@ -76,8 +76,8 @@ def read(request, year, month, day, slug): slug = slug, draft = False ) - next_post = Post.objects.filter(created_at__gt = post.created_at).order_by('created_at')[0:1] - prev_post = Post.objects.filter(created_at__lt = post.created_at).order_by('-created_at')[0:1] + next_post = Post.objects.filter(created_at__gt = post.created_at, draft = False).order_by('created_at')[0:1] + prev_post = Post.objects.filter(created_at__lt = post.created_at, draft = False).order_by('-created_at')[0:1] if not next_post: next_post = None