[IMP] models: move prefetching of records back to method _prefetch_field
[odoo/odoo.git] / doc / howto / howto_website / ta-controller
1 # HG changeset patch
2 # Parent a813df5b9cbdf5db9b0c3f6bac47b1821ddbb086
3
4 diff --git a/controllers/academy.py b/controllers/academy.py
5 --- a/controllers/academy.py
6 +++ b/controllers/academy.py
7 @@ -3,12 +3,45 @@
8  from openerp import http
9  from openerp.addons.web.controllers import main
10  
11 +teaching_assistants = [
12 +    {'name': "Diana Padilla"},
13 +    {'name': "Jody Carroll"},
14 +    {'name': "Lester Vaughn"},
15 +    {'name': "Paul Jimenez"},
16 +    {'name': "Tanya Harris"},
17 +]
18 +
19  class academy(main.Home):
20      @http.route('/', auth='none')
21      def index(self):
22 +        tas = [
23 +            '<li><a href="/tas/?id=%d">%s</a></li>' % (i, ta['name'])
24 +            for i, ta in enumerate(teaching_assistants)
25 +        ]
26 +
27          return """<!doctype html>
28  <link href="/web/static/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
29  <body class="container">
30 -    Hello, world!
31 +    <h1>Introduction to something</h1>
32 +    <h2>Teaching Assistants</h2>
33 +    <ul>
34 +        %(tas)s
35 +    </ul>
36  </body>
37 -"""
38 +""" % {
39 +        'tas': '\n'.join(tas)
40 +    }
41 +
42 +    @http.route('/tas', auth='none')
43 +    def ta(self, id):
44 +        return """<!doctype html>
45 +<html>
46 +    <head>
47 +        <title>AcademyAcademy TA %(name)s</title>
48 +        <link href="/web/static/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
49 +    </head>
50 +    <body class="container">
51 +        <h1>%(name)s</h1>
52 +    </body>
53 +</html>
54 +""" % teaching_assistants[int(id)]