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 hostel records for public users.
Getting ready
For this recipe, we will be using the my_hostel
module from the previous recipe.
Important note
If you notice, we have put auth='user'
on the /hostels
and /hostels/<model
("hostel.hostel"):hostel>
routes. Please change this to auth='public'
to make those URLs accessible to public users.
How to do it…
Perform the following steps to enable a publish/unpublish option for hostel details pages:
- Add
website.published.mixin
to thehostel.hostel
model like this:class Hostel(models.Model): _name = 'hostel.hostel' &...