Skip to content
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

Merged
merged 6 commits into from
Jul 20, 2022
Merged

Hide Unpublished Blog Posts #181

merged 6 commits into from
Jul 20, 2022

Conversation

JusticeV452
Copy link
Member

  • Users will see 404 page with navbar and link to the blog home page if they attempt to access a blog post that:
    • Does not exist
    • Is unpublished and they are not the author of the post
  • Tags associated only with unpublished blog posts are not shown on the blog home page
  • Implements the get_absolute_url method for BlogPost model

Blog home:
image

Blog post that does not exist:
image

Unpublished blog post, logged in:
image

Unpublished blog post, not logged in:
image

- Get 404-page response if blog post does not exist or post is not published and logged-in user is not post author
@JusticeV452 JusticeV452 self-assigned this Jul 15, 2022
@JusticeV452 JusticeV452 linked an issue Jul 15, 2022 that may be closed by this pull request
8 tasks
…ublished

# Conflicts:
#	backend/blog/models.py
#	backend/config/urls.py
Copy link
Member

@anastasia anastasia left a 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

backend/blog/views.py Outdated Show resolved Hide resolved
backend/blog/views.py Outdated Show resolved Hide resolved
- 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
):
Copy link
Member

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">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@anastasia
Copy link
Member

Nice, nice. Ready to merge!

@anastasia anastasia merged commit 335c65d into main Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fleshing out website Blog
2 participants