multiple variables in {% with %} tag

1,107 views
Skip to first unread message

Philipp Chapkovski

unread,
Oct 7, 2021, 5:19:19 AM10/7/21
to oTree help & discussion
This one

{% with var1=123, var2=1 %}
{% include "a.html" %}
{% endwith %}

Results in
Application error (500)TemplateSyntaxError: Unparsable expression '123, var2=1' (line 61, in "with")

Philipp Chapkovski

unread,
Oct 7, 2021, 5:26:49 AM10/7/21
to oTree help & discussion
ah, I got it: I had unsubstantiated hope that oTree uses jinja2 as a template language. It doesn't, it uses its own 'minified' version that slightly resembles jinja.

Chris @ oTree

unread,
Nov 3, 2021, 5:36:56 AM11/3/21
to oTree help & discussion
You can put them directly in the 'include' statement, separated by &:

{{ include 'a.html' with a=1 & b=2 }}

Reply all
Reply to author
Forward
0 new messages