diff --git a/doc/howto/howto_website.rst b/doc/howto/howto_website.rst index 9f0642e16c3..192f7f1b9c8 100644 --- a/doc/howto/howto_website.rst +++ b/doc/howto/howto_website.rst @@ -40,10 +40,10 @@ This builds a basic module for you: ├── __openerp__.py ├── controllers │ ├── __init__.py - │ └── my_controller.py + │ └── academy.py ├── models │ ├── __init__.py - │ └── my_model.py + │ └── academy.py └── security └── ir.model.access.csv @@ -68,7 +68,7 @@ Let's prettify things a bit: instead of returning just a bit of text, we can return a page, and use a tool like bootstrap_ to get a nicer rendering than the default. -Go to :file:`academy/controllers/my_controller.py` and change the string +Go to :file:`academy/controllers/academy.py` and change the string returned by the ``index`` method to get a more page-ish output: .. patch:: diff --git a/doc/howto/howto_website/basic-page b/doc/howto/howto_website/basic-page index 9e6c9d9abc7..765522cbbbc 100644 --- a/doc/howto/howto_website/basic-page +++ b/doc/howto/howto_website/basic-page @@ -1,11 +1,11 @@ # HG changeset patch -# Parent a76a9a0e0668f4191bdc383a0d4b3173f44b39b1 +# Parent d06b1f422ac5672c4a4c34bb3a50e98df42f3e31 -diff --git a/controllers/my_controller.py b/controllers/my_controller.py ---- a/controllers/my_controller.py -+++ b/controllers/my_controller.py +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 - class my_controller(main.Home): + class academy(main.Home): @http.route('/', auth='none') def index(self): - return "Hello, world!" diff --git a/doc/howto/howto_website/lectures-model-add b/doc/howto/howto_website/lectures-model-add index a467817faad..5fc1a7c592a 100644 --- a/doc/howto/howto_website/lectures-model-add +++ b/doc/howto/howto_website/lectures-model-add @@ -1,5 +1,5 @@ # HG changeset patch -# Parent 9042ace1e3e8175155d9dbed75657222a371cdb6 +# Parent fef5ecf2dad4b7bdcc9a760545c2689187bb15f9 diff --git a/__openerp__.py b/__openerp__.py --- a/__openerp__.py @@ -12,11 +12,11 @@ diff --git a/__openerp__.py b/__openerp__.py ], 'tests': [ ], -diff --git a/controllers/my_controller.py b/controllers/my_controller.py ---- a/controllers/my_controller.py -+++ b/controllers/my_controller.py +diff --git a/controllers/academy.py b/controllers/academy.py +--- a/controllers/academy.py ++++ b/controllers/academy.py @@ -6,10 +6,15 @@ from openerp.addons.web.controllers impo - class my_controller(main.Home): + class academy(main.Home): @http.route('/', auth='public') def index(self): + cr, uid, context = http.request.cr, http.request.uid, http.request.context @@ -60,9 +60,9 @@ new file mode 100644 + + + -diff --git a/models/my_model.py b/models/my_model.py ---- a/models/my_model.py -+++ b/models/my_model.py +diff --git a/models/academy.py b/models/academy.py +--- a/models/academy.py ++++ b/models/academy.py @@ -8,3 +8,12 @@ class TeachingAssistants(orm.Model): 'name': fields.char(), 'biography': fields.html(), diff --git a/doc/howto/howto_website/manifest b/doc/howto/howto_website/manifest index 3c81585b522..601c18c5106 100644 --- a/doc/howto/howto_website/manifest +++ b/doc/howto/howto_website/manifest @@ -43,19 +43,19 @@ new file mode 100644 +++ b/controllers/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- -+import my_controller ++import academy + -diff --git a/controllers/my_controller.py b/controllers/my_controller.py +diff --git a/controllers/academy.py b/controllers/academy.py new file mode 100644 --- /dev/null -+++ b/controllers/my_controller.py ++++ b/controllers/academy.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- + +from openerp import http +from openerp.addons.web.controllers import main + -+class my_controller(main.Home): ++class academy(main.Home): + @http.route('/', auth='none') + def index(self): + return "Hello, world!" @@ -65,18 +65,18 @@ new file mode 100644 +++ b/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- -+import my_model ++import academy + -diff --git a/models/my_model.py b/models/my_model.py +diff --git a/models/academy.py b/models/academy.py new file mode 100644 --- /dev/null -+++ b/models/my_model.py ++++ b/models/academy.py @@ -0,0 +1,9 @@ +# -*- coding: utf-8 -*- +from openerp.osv import orm, fields + -+class my_model(orm.Model): -+ _name = "academy.my_model" ++class academy(orm.Model): ++ _name = "academy.academy" + + _columns = { + 'name': fields.char(), @@ -87,4 +87,4 @@ new file mode 100644 +++ b/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -+access_academy_my_model,access_academy_my_model,model_academy_my_model,,1,0,0,0 ++access_academy_academy,access_academy_academy,model_academy_academy,,1,0,0,0 diff --git a/doc/howto/howto_website/ta-controller b/doc/howto/howto_website/ta-controller index 080111bb4d4..71a86d7311b 100644 --- a/doc/howto/howto_website/ta-controller +++ b/doc/howto/howto_website/ta-controller @@ -1,9 +1,9 @@ # HG changeset patch -# Parent a615de71be483d88acca032ad5d35072c87999c0 +# Parent e95e38d7a1c75741d1f7babf1fe6590b8227888e -diff --git a/controllers/my_controller.py b/controllers/my_controller.py ---- a/controllers/my_controller.py -+++ b/controllers/my_controller.py +diff --git a/controllers/academy.py b/controllers/academy.py +--- a/controllers/academy.py ++++ b/controllers/academy.py @@ -3,9 +3,22 @@ from openerp import http from openerp.addons.web.controllers import main @@ -16,7 +16,7 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py + {'name': "Tanya Harris"}, +] + - class my_controller(main.Home): + class academy(main.Home): @http.route('/', auth='none') def index(self): + tas = [ @@ -27,7 +27,7 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py return """
-@@ -16,6 +29,26 @@ class my_controller(main.Home): +@@ -16,6 +29,26 @@ class academy(main.Home):Course introduction
diff --git a/doc/howto/howto_website/ta-html-biography b/doc/howto/howto_website/ta-html-biography index 23da32b1e4e..a8460c3090a 100644 --- a/doc/howto/howto_website/ta-html-biography +++ b/doc/howto/howto_website/ta-html-biography @@ -1,9 +1,9 @@ # HG changeset patch -# Parent 8cbdbbeaf1d89c9a4e4d03e2392ddcc79a648206 +# Parent 313d7c760558b24461a544063de061d00fdf7059 -diff --git a/models/my_model.py b/models/my_model.py ---- a/models/my_model.py -+++ b/models/my_model.py +diff --git a/models/academy.py b/models/academy.py +--- a/models/academy.py ++++ b/models/academy.py @@ -6,4 +6,5 @@ class TeachingAssistants(orm.Model): _columns = { diff --git a/doc/howto/howto_website/ta-model b/doc/howto/howto_website/ta-model index 83a74c83c51..f5fd1013ec6 100644 --- a/doc/howto/howto_website/ta-model +++ b/doc/howto/howto_website/ta-model @@ -1,9 +1,9 @@ # HG changeset patch -# Parent b6ba23a3c284db481f14d9ea573e0baf8d3320e8 +# Parent 21954f9743a937b8185a5e717fe6af0e92660c55 -diff --git a/controllers/my_controller.py b/controllers/my_controller.py ---- a/controllers/my_controller.py -+++ b/controllers/my_controller.py +diff --git a/controllers/academy.py b/controllers/academy.py +--- a/controllers/academy.py ++++ b/controllers/academy.py @@ -3,19 +3,13 @@ from openerp import http from openerp.addons.web.controllers import main @@ -16,7 +16,7 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py - {'name': "Tanya Harris"}, -] - - class my_controller(main.Home): + class academy(main.Home): @http.route('/', auth='public') def index(self): + tas = http.request.registry['academy.tas'].search_read( @@ -27,15 +27,15 @@ diff --git a/controllers/my_controller.py b/controllers/my_controller.py }) @http.route('/tas/