20.4.2 Future Posts Mixin
We’ve limited the use of permissions to a Boolean that determines whether a user can or cannot see and use a webpage. While this is the simplest way to use permissions, remember that Django provides the ability to use permissions on single objects. We won’t use the permissions for individual objects, but we can use a permission to create a separate class of object.
Earlier in the chapter, we created the view_future_post permission with the intent that it would limit the display of Post objects with pub_date fields set to future dates. We want to make it so that only users with the permission can see unpublished Post objects. This means not only limiting specific Post detail webpages but also changing which Post objects ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access