odoo/doc/howto/howto_website/url-pattern

31 lines
956 B
Plaintext

# HG changeset patch
# Parent 1d6a01fae0bb650ea0de8437b3983a29f66463ed
diff --git a/controllers/my_controller.py b/controllers/my_controller.py
--- a/controllers/my_controller.py
+++ b/controllers/my_controller.py
@@ -15,7 +15,7 @@ class my_controller(main.Home):
@http.route('/', auth='none')
def index(self):
tas = [
- '<li><a href="/tas/?id=%d">%s</a></li>' % (i, ta['name'])
+ '<li><a href="/tas/%d/">%s</a></li>' % (i, ta['name'])
for i, ta in enumerate(teaching_assistants)
]
@@ -39,7 +39,7 @@ class my_controller(main.Home):
'tas': '\n'.join(tas)
}
- @http.route('/tas', auth='none')
+ @http.route('/tas/<int:id>/', auth='none')
def ta(self, id):
return """<!doctype html>
<html>
@@ -51,4 +51,4 @@ class my_controller(main.Home):
<h1>%(name)s</h1>
</body>
</html>
-""" % teaching_assistants[int(id)]
+""" % teaching_assistants[id]