Reputation: 15824
Based upon whether a custom-defined context variable {{ state }}
is true
or false
, I want to extend a different flavor of base.html
in a Django template.
What's the Django template code to make this happen?
I'm trying: {% extends state|yesno:"base1.html;base2.html" %}
but unsure whether this is correct.
Upvotes: 3
Views: 604
Reputation: 11961
You are almost there - you just need to replace your semi-colon ;
with a commma ,
:
{% extends state|yesno:"base1.html,base2.html" %}
Upvotes: 2