我正在尝试扩展 qweb 模板视图。但这不起作用。 这是我的代码。
my_module/static/src/xml/website.xml
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="website.homepage_editor_welcome_message" >
<t t-jquery=".lead" t-operation="replace">
<p class="lead second_head">Let's start designing.</p>
</t>
</t>
</templates>
这是来自
website
模块的原始代码。
<div t-name="website.homepage_editor_welcome_message" class="container text-center o_homepage_editor_welcome_message">
<h2 class="mt0">Welcome to your <b>Homepage</b>!</h2>
<p class="lead">Let's start designing.</p>
<div class="o_tooltip_container">Follow all the <div class="o_tooltip bottom"/> signs to get your website ready in no time.</div>
</div>
并在
__manifest__.py
中添加XML文件,如下所示。
'qweb': ['static/src/xml/website.xml'],
但网站没有变化。
我该怎么做?
我发现能够继承使用 t-name 声明的 Qweb 模板的唯一方法是在自定义模块中重新定义它,直接更改代码。您将覆盖现有的。
嗨,这对我不起作用,兄弟