Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3216 Lượt xem

I'm working on a form and the result will be the name showing in the URL.
http://domain.com/folder/{title}/show/
How do I replace characters Odoo-style!?

       title = ""

       if post.get('title') == "":
            title = "Showcase"
        else:
            title = post.get('title').
****
        # REPLACE FROM BAD/INVALID CHARS
        title = title.encode('utf-8')

       title = title.replace(" ", "_").
****
I've been struggling with this headache... What am I mIssing!?

I must have proper and Internet-friendly name for this current project, because the name och the post need to be

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi, try to specify dynamic http.route urls and try to slugify the name.

Many examples might be found in the website_sale controllers: https://github.com/odoo/odoo/blob/10.0/addons/website_sale/controllers/main.py

Look at the method 'def shop', and how your goal is achieved for product category (and its proper name in the url)

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 10 16
7276
0
thg 1 25
706
1
thg 12 23
8702
2
thg 9 23
6809
5
thg 12 23
27359