odoo/doc/howtos/website/converter-model

45 lines
1.6 KiB
Plaintext

# HG changeset patch
# Parent 122340f4360287bbc53f54e53ac609a8e7237796
# Parent 1f9194514fa81c49b9bc7922a010513d816a0c2e
diff --git a/academy/controllers.py b/academy/controllers.py
--- a/academy/controllers.py
+++ b/academy/controllers.py
@@ -9,9 +9,11 @@ class Academy(http.Controller):
'teachers': Teachers.search([])
})
- @http.route('/academy/<int:id>/', auth='public', website=True)
- def teacher(self, id):
- return '<h1>{} ({})</h1>'.format(id, type(id).__name__)
+ @http.route('/academy/<model("academy.teachers"):teacher>/', auth='public', website=True)
+ def teacher(self, teacher):
+ return http.request.render('academy.biography', {
+ 'person': teacher
+ })
# @http.route('/academy/academy/objects/', auth='public')
diff --git a/academy/templates.xml b/academy/templates.xml
--- a/academy/templates.xml
+++ b/academy/templates.xml
@@ -12,6 +12,18 @@
</div>
</t>
</template>
+ <template id="biography">
+ <t t-call="website.layout">
+ <t t-set="title">Academy</t>
+ <div class="oe_structure"/>
+ <div class="oe_structure">
+ <div class="container">
+ <p><t t-esc="person.id"/> <t t-esc="person.name"/></p>
+ </div>
+ </div>
+ <div class="oe_structure"/>
+ </t>
+ </template>
<!-- <template id="object"> -->
<!-- <h1><t t-esc="object.display_name"/></h1> -->
<!-- <dl> -->