Sunday, 15 March 2015

Django: Nested templates such as {{ foo.{{ bar.baz }} }} -



Django: Nested templates such as {{ foo.{{ bar.baz }} }} -

i have django template calls object’s field, such object.dictionary.key.

the thing is, value of key want given other_variable.other_field.

is {% object.dictionary.{{ other_variable.other_field }} %} legal? there workaround?

i've been poking around answers django nested-template questions, none of them seem asking this.

if it's dictionary, next should work:

{{ object.dictionary.other_variable.other_field }}

django django-templates nested

No comments:

Post a Comment