Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Routing in my controller

By
Hamid Darabi
on 10/24/14, 2:01 PM 958 views

I'm reading the tutorials to develop the academy module. I have this controller:


from openerp import http
class Academy(http.Controller):
    @http.route('/academy/', auth='public', website=True)
    def index(self):
        Teachers = http.request.env['academy.teachers']
        return http.request.render('academy.index', {
            'teachers': Teachers.search([]),
        })
 @http.route('/academy/<model("academy.teachers"):teacher>/', auth='public', website=True)
 def teacher(self, teacher):
  return http.request.render('academy.biography', {
   'person': teacher
  })


The first routing for list of teachers works just fine but when I call second one, I get the 404-Not Found error message. When I seperate two routings by putting them in seperate files, both of them work perfectly. I want to put both of them in one single file, Am I missing something here?

 

But the "Hello World" example appeared, earlier?

Fnordbedarf
on 10/27/14, 11:31 AM

Yes, why?

Analystik, Hamid Darabi
on 10/27/14, 11:33 AM

You've got a problem with that?

Analystik, Hamid Darabi
on 10/27/14, 11:34 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 10/24/14, 2:01 PM
Seen: 958 times
Last updated: 3/16/15, 8:10 AM