oTree Forum >

New template tag: {{ include_sibling }}

#1 by Chris_oTree

I have added {{ include_sibling }} as an alternative to {{ include }} for including another template. The advantage is that you can omit the name of the app: {{ include_sibling 'xyz.html' }} instead of {{ include 'my_app/xyz.html' }}. However, if the includable template is in a different folder, you must use {{ include }}.


#2 by gmdcastillo (edited )

Nice, thanks a lot!

Once thing that would be nice to have in the doc as well is where oTree 5 looks for template. I think all of these are searched by oTree but I'm not 100% sure
- '_templates/'
- '_templates/my_app/'
- 'my_app/' (the new oTree style)
- 'my_app/templates/my_app/' (the old Django style)

edit: and also I discovered that the template filter '|default:' works by looking at filter.py but I don't thinking this is documented.
And it would be super useful if '|default_if_none:' would also be ported to oTree 5.

Write a reply

Set forum username