March 2018
Beginner to intermediate
336 pages
8h 22m
English
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 ...
Read now
Unlock full access