odoo/doc/howto/howto_website/ta-view-fix

39 lines
1.5 KiB
Plaintext

# HG changeset patch
# Parent fa3e25d0315e54de4bd983ad8532044b5e2df233
diff --git a/controllers/my_controller.py b/controllers/my_controller.py
--- a/controllers/my_controller.py
+++ b/controllers/my_controller.py
@@ -12,6 +12,8 @@ class my_controller(main.Home):
'tas': tas,
})
- @http.route('/tas/<int:id>/', auth='public', website=True)
+ @http.route('/tas/<model("academy.tas"):ta>/', auth='public', website=True)
def ta(self, id):
- return http.request.website.render('academy.ta', teaching_assistants[id])
+ return http.request.website.render('academy.ta', {
+ 'ta': ta,
+ })
diff --git a/views/templates.xml b/views/templates.xml
--- a/views/templates.xml
+++ b/views/templates.xml
@@ -17,7 +17,7 @@
<h2>Teaching Assistants</h2>
<ul>
<li t-foreach="tas" t-as="ta">
- <a t-att-href="url_for('/tas/%d/' % ta_index)">
+ <a t-att-href="url_for('/tas/%s/' % ta['id'])">
<t t-esc="ta['name']"/>
</a>
</li>
@@ -35,7 +35,7 @@
<div class="oe_structure"/>
<div class="oe_structure">
<div class="container">
- <h1><t t-esc="name"/></h1>
+ <h1><t t-esc="ta.name"/></h1>
</div>
</div>
<div class="oe_structure"/>