Skip to content
  • Categories
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse

Odoo 中文社区

  1. Home
  2. Categories
  3. Odoo 开发与实施交流
  4. controllers中的auth=“user”对应的方法,如何使用?

controllers中的auth=“user”对应的方法,如何使用?

Scheduled Pinned Locked Moved Odoo 开发与实施交流
1 Posts 1 Posters 807 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eric2017
    wrote on last edited by
    #1

    例如:

    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'那样访问这个方法?

    1 Reply Last reply
    0

    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
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Tags
    • Popular
    • Users
    • Groups