November 2015
Beginner to intermediate
840 pages
26h 30m
English
When we created the AllowFuturePermissionMixin class, we successfully limited the Post views to only display future blog posts to users with the blog.view_future_post permission. However, we have Post objects listed in the tag_detail.html and startup_detail.html templates, and these are not using the permission system.
In the template, we therefore create a condition to check whether the user has the permission and the display either all of the posts or all of the published posts. By design, the template system cannot pass arguments to methods. We therefore cannot create a queryset for published posts in the template, and nor would we want to, given the philosophy of “fat models, thin templates.” ...
Read now
Unlock full access