You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder if there is some way to expand dict items in included template context as variables.
So I need something like for some dict mydict with keys x and y:
{% include "b.html" with **mydict %}
And make x, y accessible in included template as variables.
I can only do now: {% include "b.html" with mydict=mydict %}
or {% include "b.html" with x=mydict.x, y=mydict.y %}
But both ways are inconvenient:
1 way. I need to refer variables by dict name in included template: mydict.x, mydict.y
2 way. I need to specify all dict keys during include
Looks like with **mydict is really helpful.
Any comments? Ideas? Maybe this feature is already on the roadmap?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folk,
I wonder if there is some way to expand dict items in included template context as variables.
So I need something like for some dict mydict with keys x and y:
{% include "b.html" with **mydict %}
And make x, y accessible in included template as variables.
I can only do now:
{% include "b.html" with mydict=mydict %}
or
{% include "b.html" with x=mydict.x, y=mydict.y %}
But both ways are inconvenient:
1 way. I need to refer variables by dict name in included template: mydict.x, mydict.y
2 way. I need to specify all dict keys during include
Looks like
with **mydict
is really helpful.Any comments? Ideas? Maybe this feature is already on the roadmap?
Sergey.
Beta Was this translation helpful? Give feedback.
All reactions