-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide Unpublished Blog Posts #181
Conversation
- Removed unused imports
- Get 404-page response if blog post does not exist or post is not published and logged-in user is not post author
…ublished # Conflicts: # backend/blog/models.py # backend/config/urls.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost ready to go! A couple structural and cosmetic changes
- Enabled staff and superusers to view unpublished posts at their intended url. - Added message to the top of unpublished blog post page, indicating that the post is unpublished (message also states how to publish post).
- Now require that staff specifically have the `blog.view_blogpost` permission - Updated unpublished post header message
or request.user == posts[0].author | ||
or request.user.is_staff | ||
or request.user.is_superuser | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
@@ -1,6 +1,12 @@ | |||
{% include "base.html" %} | |||
{% block content %} | |||
<div class="blog" id="app_root"> | |||
{% if not post.published %} | |||
<h5 style="white-space: pre-wrap"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Nice, nice. Ready to merge! |
get_absolute_url
method for BlogPost modelBlog home:
Blog post that does not exist:
Unpublished blog post, logged in:
Unpublished blog post, not logged in: