2014-01-27 15:54:00 +00:00
|
|
|
# HG changeset patch
|
2014-02-05 14:54:50 +00:00
|
|
|
# Parent 5426218c6da91a13911e64eeb18a0cc2e19083c7
|
2014-01-27 15:54:00 +00:00
|
|
|
|
|
|
|
diff --git a/__openerp__.py b/__openerp__.py
|
|
|
|
--- a/__openerp__.py
|
|
|
|
+++ b/__openerp__.py
|
2014-02-05 14:54:50 +00:00
|
|
|
@@ -15,7 +15,7 @@
|
|
|
|
'version': '0.1',
|
|
|
|
|
|
|
|
# any module necessary for this one to work correctly
|
|
|
|
- 'depends': ['web'],
|
2014-01-27 15:54:00 +00:00
|
|
|
+ 'depends': ['website'],
|
|
|
|
'data': [
|
2014-02-05 14:54:50 +00:00
|
|
|
'security/ir.model.access.csv',
|
2014-01-27 15:54:00 +00:00
|
|
|
'views/templates.xml',
|
2014-02-05 14:54:50 +00:00
|
|
|
diff --git a/controllers/my_controller.py b/controllers/my_controller.py
|
|
|
|
--- a/controllers/my_controller.py
|
|
|
|
+++ b/controllers/my_controller.py
|
|
|
|
@@ -12,17 +12,12 @@ teaching_assistants = [
|
2014-01-27 15:54:00 +00:00
|
|
|
]
|
|
|
|
|
2014-02-05 14:54:50 +00:00
|
|
|
class my_controller(main.Home):
|
2014-01-27 15:54:00 +00:00
|
|
|
- @http.route('/', auth='none')
|
|
|
|
+ @http.route('/', auth='public')
|
|
|
|
def index(self):
|
|
|
|
- tas = [
|
|
|
|
- '<li><a href="/tas/%d/">%s</a></li>' % (i, ta['name'])
|
|
|
|
- for i, ta in enumerate(teaching_assistants)
|
|
|
|
- ]
|
|
|
|
+ return http.request.website.render('academy.index', {
|
|
|
|
+ 'tas': teaching_assistants,
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- return "" % {
|
|
|
|
- 'tas': '\n'.join(tas)
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @http.route('/tas/<int:id>/', auth='none')
|
|
|
|
+ @http.route('/tas/<int:id>/', auth='public', website=True)
|
|
|
|
def ta(self, id):
|
|
|
|
- return "" % teaching_assistants[id]
|
|
|
|
+ return http.request.website.render('academy.ta', teaching_assistants[id])
|
|
|
|
diff --git a/views/templates.xml b/views/templates.xml
|
|
|
|
--- a/views/templates.xml
|
|
|
|
+++ b/views/templates.xml
|
|
|
|
@@ -17,7 +17,11 @@
|
|
|
|
</p>
|
|
|
|
<h2>Teaching Assistants</h2>
|
|
|
|
<ul>
|
|
|
|
- <t t-raw="tas"/>
|
|
|
|
+ <li t-foreach="tas" t-as="ta">
|
|
|
|
+ <a t-att-href="url_for('/tas/%d/' % ta_index)">
|
|
|
|
+ <t t-esc="ta['name']"/>
|
|
|
|
+ </a>
|
|
|
|
+ </li>
|
|
|
|
</ul>
|
|
|
|
</body>
|
|
|
|
</html>
|