58 lines
1.6 KiB
Plaintext
58 lines
1.6 KiB
Plaintext
# HG changeset patch
|
|
# Parent 77db36690ddd8ad5065cab77837deec9da3df502
|
|
|
|
diff --git a/__openerp__.py b/__openerp__.py
|
|
--- a/__openerp__.py
|
|
+++ b/__openerp__.py
|
|
@@ -1,6 +1,7 @@
|
|
{
|
|
'name': "Academy",
|
|
'category': "Tools",
|
|
+ 'depends': ['website'],
|
|
'data': [
|
|
'views/templates.xml',
|
|
]
|
|
diff --git a/controllers.py b/controllers.py
|
|
--- a/controllers.py
|
|
+++ b/controllers.py
|
|
@@ -10,17 +10,12 @@ teaching_assistants = [
|
|
]
|
|
|
|
class Home(main.Home):
|
|
- @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>
|