controllers中的auth=“user”对应的方法,如何使用?
-
例如:
from odoo import http class Books(http.Controller): @http.route('/library/books', auth='user') def list(self, **kwargs): Book = http.request.env['library.book'] books = Book.search([]) return http.request.render( 'library_app.book_list_template', {'books':books})如果auth='public',那么,可以在postman中,通过:http://localhost:8069/library/books来访问这个方法;
但是,auth='user'时,得到的结果是登陆页面的代码。
那么,如何操作,才能像auth='public'那样访问这个方法?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login