Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
djangocms-blog-view-restrictions
Advanced tools
Control who can view your djangocms blog posts
Install the package
python3 -m pip install djangocms-blog-view-restrictions
Add it in your INSTALLED_APPS
:
"djangocms_blog_view_restrictions",
Run the migration:
python3 manage.py migrate djangocms_blog_view_restrictions
When creating/editing a blog post, a new "View restriction" section allows you to define multiple users/groups that are allowed to view the post. The user is allowed to view the post if any of the restrictions are met.
You are then responsible to hide partially or totally the post's content in your djangocms_blog/post_detail.html
template:
{% extends "djangocms_blog/post_detail.html" %}
{% load blog_view_restrictions_tags %}
{% block content_blog %}
<article>
{{ post.abstract }}
{% if request.user|can_view_post:post %}
{% if post.app_config.use_placeholder %}
<div class="blog-content">{% render_placeholder post.content %}</div>
{% else %}
<div class="blog-content">{% render_model post "post_text" "post_text" "" "safe" %}</div>
{% endif %}
{% else %}
This post is for subscribers only.
{% endif %}
...
</article>
{% endblock content_blog %}
FAQs
Control who can view your djangocms-blog posts
We found that djangocms-blog-view-restrictions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.