Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow superusers to preview future blog posts. #40

Open
wants to merge 1 commit into from

1 participant

@mness

This change fixes a small bug with the basic blog application. Update the blog software so that superusers can preview posts that have a publish date in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 2, 2012
  1. Allow superusers to preview future blog posts.

    Jeremiah Ness authored
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 0 deletions.
  1. +3 −0  basic/blog/views.py
View
3  basic/blog/views.py
@@ -68,8 +68,10 @@ def post_detail(request, slug, year, month, day, **kwargs):
unpublished post detail for previewing purposes.
"""
posts = None
+ allow_future = False
if request.user.is_superuser:
posts = Post.objects.all()
+ allow_future = True
else:
posts = Post.objects.published()
return date_based.object_detail(
@@ -80,6 +82,7 @@ def post_detail(request, slug, year, month, day, **kwargs):
date_field='publish',
slug=slug,
queryset=posts,
+ allow_future=allow_future,
**kwargs
)
post_detail.__doc__ = date_based.object_detail.__doc__
Something went wrong with that request. Please try again.