December 2018
Beginner to intermediate
404 pages
10h 14m
English
Each item in the checkout list has a link to the corresponding detail page. We should implement a controller for those links and a QWeb template for their presentation. At this point, this should be a straightforward exercise.
In the library_website/controllers/main.py file, add the the following method:
#class Main(http.Controller):
#...
@http.route('/checkout/<model("library.checkout"):doc>', auth="user", # default, but made explicit here website=True)
def checkout(self, doc, **kwargs):
return http.request.render(
'library_website.checkout',
{'doc': doc})
Notice that the route is using a placeholder with the model("library.checkout") converter, which will be mapped to the method's doc argument. It captures a ...
Read now
Unlock full access