Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
5778 Переглядів

I'm have a page that accepts a get parameter to set the the field name I want to edit but can't make it to work with qweb syntax. An example of the qweb code is.
<div t-field="record.content"/>

I think I need something like :

<div t-field="record.#{field}"/>
or something like that.

I need to be able to set the content field dynamically that now is fixed in the example. Thanks in advance.!

EDIT: I think I must use t-field in order to be able to edit it in the website editor. That's why I can't use computed fields.

Аватар
Відмінити
Автор Найкраща відповідь

But that way the field wouln't be editable with the website editor which is my goal.

Аватар
Відмінити
Найкраща відповідь

You can create a function that will return the value you expect, and then add it to your Qweb.

To do this you create your function
function_dynamic def (self):

you add to your self.localcontext.update
'function': self.function_dynamic

And for your Qweb you add
<div t-esc = "function">

Greetings.

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
груд. 24
2288
4
трав. 23
10557
1
січ. 19
9648
0
жовт. 17
3468
0
лист. 16
2737