Next/previous post links now omit drafts
This commit is contained in:
parent
d1ba92a621
commit
eea5be4323
@ -76,8 +76,8 @@ def read(request, year, month, day, slug):
|
|||||||
slug = slug,
|
slug = slug,
|
||||||
draft = False
|
draft = False
|
||||||
)
|
)
|
||||||
next_post = Post.objects.filter(created_at__gt = 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).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:
|
if not next_post:
|
||||||
next_post = None
|
next_post = None
|
||||||
|
Loading…
Reference in New Issue
Block a user