Publish management for website-related records
In business flows, there are some cases where you need to allow or revoke page access to public users. One such case is e-commerce products, where you need to publish or unpublish products based on availability. In this recipe, we will see how you can publish and unpublish book records for public users.
Getting ready
For this recipe, we will be using the my_library
module from the previous recipe.
Important note
If you notice, we have put auth='user'
on the /books
and /books/ <model("library.book"):book>
routes. Please change this to auth='public'
to make those URLs accessible for public users.
How to do it…
Perform the following steps to enable a publish/unpublish option for book detail pages:
- Add
website.published.mixin
to thelibrary.book
model like this:class LibraryBook(models.Model): Â Â Â Â _name = 'library.book' Â Â Â Â ...