[IMP] slightly simplify first code snippet
This commit is contained in:
parent
8bcc42d4d0
commit
d3268420ae
|
@ -24,6 +24,8 @@ create a module:
|
|||
|
||||
.. todo:: output directory probably shouldn't be ``.``
|
||||
|
||||
.. todo:: ``oe`` v ``./oe``?
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ oe scaffold Academy .
|
||||
|
|
|
@ -1,24 +1,17 @@
|
|||
# HG changeset patch
|
||||
# Parent d06b1f422ac5672c4a4c34bb3a50e98df42f3e31
|
||||
# Parent b96cd22d25cfa9a67f451d091f5c4896997d350d
|
||||
|
||||
diff --git a/controllers/academy.py b/controllers/academy.py
|
||||
--- a/controllers/academy.py
|
||||
+++ b/controllers/academy.py
|
||||
@@ -6,4 +6,16 @@ from openerp.addons.web.controllers impo
|
||||
@@ -6,4 +6,9 @@ from openerp.addons.web.controllers impo
|
||||
class academy(main.Home):
|
||||
@http.route('/', auth='none')
|
||||
def index(self):
|
||||
- return "Hello, world!"
|
||||
+ return """<!doctype html>
|
||||
+<html>
|
||||
+ <head>
|
||||
+ <title>AcademyAcademy</title>
|
||||
+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
|
||||
+ </head>
|
||||
+ <body class="container">
|
||||
+ <h1>Introduction to a thing</h1>
|
||||
+ <h2>Course description</h2>
|
||||
+ <p>Course introduction</p>
|
||||
+ </body>
|
||||
+</html>
|
||||
+<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
+<body class="container">
|
||||
+ <h1>Introduction to a thing</h1>
|
||||
+</body>
|
||||
+"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# HG changeset patch
|
||||
# Parent fef5ecf2dad4b7bdcc9a760545c2689187bb15f9
|
||||
# Parent dc6e1146075f61db66b1f7d2b7d3b8e76341e7bb
|
||||
|
||||
diff --git a/__openerp__.py b/__openerp__.py
|
||||
--- a/__openerp__.py
|
||||
|
@ -17,7 +17,7 @@ diff --git a/controllers/academy.py b/controllers/academy.py
|
|||
+++ b/controllers/academy.py
|
||||
@@ -6,10 +6,15 @@ from openerp.addons.web.controllers impo
|
||||
class academy(main.Home):
|
||||
@http.route('/', auth='public')
|
||||
@http.route('/', auth='public', website=True)
|
||||
def index(self):
|
||||
+ cr, uid, context = http.request.cr, http.request.uid, http.request.context
|
||||
+ Lectures = http.request.registry['academy.lectures']
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
# HG changeset patch
|
||||
# Parent e95e38d7a1c75741d1f7babf1fe6590b8227888e
|
||||
# Parent a110c540b0769ee849a404324cf8594d116cc982
|
||||
|
||||
diff --git a/controllers/academy.py b/controllers/academy.py
|
||||
--- a/controllers/academy.py
|
||||
+++ b/controllers/academy.py
|
||||
@@ -3,9 +3,22 @@
|
||||
@@ -3,12 +3,45 @@
|
||||
from openerp import http
|
||||
from openerp.addons.web.controllers import main
|
||||
|
||||
|
@ -25,18 +25,14 @@ diff --git a/controllers/academy.py b/controllers/academy.py
|
|||
+ ]
|
||||
+
|
||||
return """<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -16,6 +29,26 @@ class academy(main.Home):
|
||||
<h1>Introduction to a thing</h1>
|
||||
<h2>Course description</h2>
|
||||
<p>Course introduction</p>
|
||||
+ <h2>Teaching Assistants</h2>
|
||||
+ <ul>
|
||||
+ %(tas)s
|
||||
+ </ul>
|
||||
</body>
|
||||
</html>
|
||||
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<body class="container">
|
||||
<h1>Introduction to a thing</h1>
|
||||
+ <h2>Teaching Assistants</h2>
|
||||
+ <ul>
|
||||
+ %(tas)s
|
||||
+ </ul>
|
||||
</body>
|
||||
-"""
|
||||
+""" % {
|
||||
+ 'tas': '\n'.join(tas)
|
||||
|
@ -48,7 +44,7 @@ diff --git a/controllers/academy.py b/controllers/academy.py
|
|||
+<html>
|
||||
+ <head>
|
||||
+ <title>AcademyAcademy TA %(name)s</title>
|
||||
+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
|
||||
+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
+ </head>
|
||||
+ <body class="container">
|
||||
+ <h1>%(name)s</h1>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# HG changeset patch
|
||||
# Parent 21954f9743a937b8185a5e717fe6af0e92660c55
|
||||
# Parent e8b98f4c8f9070f7d5b91936381324cd1fe12e17
|
||||
|
||||
diff --git a/controllers/academy.py b/controllers/academy.py
|
||||
--- a/controllers/academy.py
|
||||
|
@ -17,7 +17,7 @@ diff --git a/controllers/academy.py b/controllers/academy.py
|
|||
-]
|
||||
-
|
||||
class academy(main.Home):
|
||||
@http.route('/', auth='public')
|
||||
@http.route('/', auth='public', website=True)
|
||||
def index(self):
|
||||
+ tas = http.request.registry['academy.tas'].search_read(
|
||||
+ http.request.cr, http.request.uid, context=http.request.context)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# HG changeset patch
|
||||
# Parent 5342fd2d61587d3ab2c29f88e813b9a402eaa808
|
||||
# Parent 93586905ed9663bf48ef33ca6476a537a8f96ac8
|
||||
|
||||
diff --git a/__openerp__.py b/__openerp__.py
|
||||
--- a/__openerp__.py
|
||||
|
@ -19,7 +19,7 @@ diff --git a/__openerp__.py b/__openerp__.py
|
|||
diff --git a/controllers/academy.py b/controllers/academy.py
|
||||
--- a/controllers/academy.py
|
||||
+++ b/controllers/academy.py
|
||||
@@ -14,41 +14,18 @@ teaching_assistants = [
|
||||
@@ -14,34 +14,17 @@ teaching_assistants = [
|
||||
class academy(main.Home):
|
||||
@http.route('/', auth='none')
|
||||
def index(self):
|
||||
|
@ -30,35 +30,28 @@ diff --git a/controllers/academy.py b/controllers/academy.py
|
|||
]
|
||||
|
||||
- return """<!doctype html>
|
||||
-<html>
|
||||
- <head>
|
||||
- <title>AcademyAcademy</title>
|
||||
- <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
|
||||
- </head>
|
||||
- <body class="container">
|
||||
- <h1>Introduction to a thing</h1>
|
||||
- <h2>Course description</h2>
|
||||
- <p>Course introduction</p>
|
||||
- <h2>Teaching Assistants</h2>
|
||||
- <ul>
|
||||
- %(tas)s
|
||||
- </ul>
|
||||
- </body>
|
||||
-</html>
|
||||
-<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
-<body class="container">
|
||||
- <h1>Introduction to a thing</h1>
|
||||
- <h2>Teaching Assistants</h2>
|
||||
- <ul>
|
||||
- %(tas)s
|
||||
- </ul>
|
||||
-</body>
|
||||
-""" % {
|
||||
- 'tas': '\n'.join(tas)
|
||||
- }
|
||||
-
|
||||
+ return http.request.registry['ir.ui.view'].render(cr, uid, 'academy.index', {
|
||||
+ 'tas': '\n'.join(tas)
|
||||
+ }, context=context)
|
||||
|
||||
@http.route('/tas/<int:id>/', auth='none')
|
||||
def ta(self, id):
|
||||
- return """<!doctype html>
|
||||
-<html>
|
||||
- <head>
|
||||
- <title>AcademyAcademy TA %(name)s</title>
|
||||
- <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
|
||||
- <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
- </head>
|
||||
- <body class="container">
|
||||
- <h1>%(name)s</h1>
|
||||
|
@ -67,7 +60,7 @@ diff --git a/controllers/academy.py b/controllers/academy.py
|
|||
-""" % teaching_assistants[id]
|
||||
+ cr, uid, context = http.request.cr, http.request.uid, http.request.context
|
||||
+ return http.request.registry['ir.ui.view'].render(
|
||||
+ cr, uid, "academy.ta", teaching_assistants[id], context=context)
|
||||
+ cr, uid, 'academy.ta', teaching_assistants[id], context=context)
|
||||
diff --git a/views/templates.xml b/views/templates.xml
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
|
@ -79,7 +72,7 @@ new file mode 100644
|
|||
+ <html>
|
||||
+ <head>
|
||||
+ <title>AcademyAcademy</title>
|
||||
+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
+ </head>
|
||||
+ <body class="container">
|
||||
+ <h1>Introduction to a thing</h1>
|
||||
|
@ -102,7 +95,7 @@ new file mode 100644
|
|||
+ <html>
|
||||
+ <head>
|
||||
+ <title>AcademyAcademy TA <t t-esc="name"/></title>
|
||||
+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
+ <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
+ </head>
|
||||
+ <body class="container">
|
||||
+ <h1><t t-esc="name"/></h1>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# HG changeset patch
|
||||
# Parent dce817856f7995c3220ef7261c26b83006c3627e
|
||||
# Parent 0fdf3e29ce5bb1dd39479f157eeac5bdfd3cffb0
|
||||
|
||||
diff --git a/__openerp__.py b/__openerp__.py
|
||||
--- a/__openerp__.py
|
||||
|
@ -16,9 +16,12 @@ diff --git a/__openerp__.py b/__openerp__.py
|
|||
diff --git a/controllers/academy.py b/controllers/academy.py
|
||||
--- a/controllers/academy.py
|
||||
+++ b/controllers/academy.py
|
||||
@@ -14,18 +14,10 @@ teaching_assistants = [
|
||||
@@ -12,19 +12,12 @@ teaching_assistants = [
|
||||
]
|
||||
|
||||
class academy(main.Home):
|
||||
@http.route('/', auth='none')
|
||||
- @http.route('/', auth='none')
|
||||
+ @http.route('/', auth='none', website=True)
|
||||
def index(self):
|
||||
- cr, uid, context = http.request.cr, http.request.uid, http.request.context
|
||||
- tas = [
|
||||
|
@ -32,13 +35,12 @@ diff --git a/controllers/academy.py b/controllers/academy.py
|
|||
- return http.request.registry['ir.ui.view'].render(cr, uid, 'academy.index', {
|
||||
- 'tas': '\n'.join(tas)
|
||||
- }, context=context)
|
||||
-
|
||||
- @http.route('/tas/<int:id>/', auth='none')
|
||||
+ @http.route('/tas/<int:id>/', auth='none', website=True)
|
||||
def ta(self, id):
|
||||
- cr, uid, context = http.request.cr, http.request.uid, http.request.context
|
||||
- return http.request.registry['ir.ui.view'].render(
|
||||
- cr, uid, "academy.ta", teaching_assistants[id], context=context)
|
||||
- cr, uid, 'academy.ta', teaching_assistants[id], context=context)
|
||||
+ return http.request.website.render('academy.ta', teaching_assistants[id])
|
||||
diff --git a/views/templates.xml b/views/templates.xml
|
||||
--- a/views/templates.xml
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# HG changeset patch
|
||||
# Parent 006b3182bb96e16310fd6fc4be808bd5698f1ab6
|
||||
# Parent 69c500d7634c0e5287508cfaffa14174cc47d800
|
||||
|
||||
diff --git a/controllers/academy.py b/controllers/academy.py
|
||||
--- a/controllers/academy.py
|
||||
|
@ -8,8 +8,8 @@ diff --git a/controllers/academy.py b/controllers/academy.py
|
|||
]
|
||||
|
||||
class academy(main.Home):
|
||||
- @http.route('/', auth='none')
|
||||
+ @http.route('/', auth='public')
|
||||
- @http.route('/', auth='none', website=True)
|
||||
+ @http.route('/', auth='public', website=True)
|
||||
def index(self):
|
||||
return http.request.website.render('academy.index', {
|
||||
'tas': teaching_assistants,
|
||||
|
@ -29,7 +29,7 @@ diff --git a/views/templates.xml b/views/templates.xml
|
|||
- <html>
|
||||
- <head>
|
||||
- <title>AcademyAcademy</title>
|
||||
- <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
- <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
- </head>
|
||||
- <body class="container">
|
||||
- <h1>Introduction to a thing</h1>
|
||||
|
@ -83,7 +83,7 @@ diff --git a/views/templates.xml b/views/templates.xml
|
|||
- <html>
|
||||
- <head>
|
||||
- <title>AcademyAcademy TA <t t-esc="name"/></title>
|
||||
- <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
- <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
|
||||
- </head>
|
||||
- <body class="container">
|
||||
- <h1><t t-esc="name"/></h1>
|
||||
|
|
Loading…
Reference in New Issue