Skip to Content
Menu
This question has been flagged
1 Reply
2326 Views

I come from a Django background and an app can register template directives and they are available to all other apps (there is a central registry basically).  Is there a way for my app to register a  new Qweb directive/tag?

For example i may want to create something like: <t thumbnail="{'image':o.image,'format':'90x90 bw'}/>

So, is there a way to hook up extra directives  to QWeb?

Avatar
Discard
Author Best Answer

I'm answering my own question here but the solution is not that hard.

You can take a look at   https://github.com/OCA/server-tools/tree/8.0/qweb_usertime which does exactly that.

Basically override QWeb model like you would any model, and define your own render_tag_<tagname>() method.  

Avatar
Discard