The To-Do Task detail page

Each item in the Todo 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 todo_website/controllers/main.py file, add the method:

#class Todo(http.Controller):
#... 
    @http.route('/todo/<model("todo.task"):task>',                 auth="user",  # default, but made explicit here                website=True) 
    def detail(self, task, **kwargs): 
        return http.request.render( 
            'todo_website.detail', 
            {'task': task}) 

Notice that the route is using a placeholder with the model("todo.task") converter, which will be mapped to the method's task argument. It captures a Task identifier from the URL, either a ...

Get Odoo 11 Development Essentials - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.