Django execute block tag inside 'if' statement in template only if 'if' statement is true -
i want execute block tag if if statement true. here mean. template:
{% extends "homepagebase.html" %} {% if not blogpage %} {% block isblogfalse %} notblogpage {% endblock %} {% else %} {% block isblogtrue %} blogpage {% endblock %} {% endif %}
but both block tags executed. there way block tags executed if if / else statements true? way around issue or way of accomplishing task?
one answer problem can found @ https://stackoverflow.com/a/18638131/573392. modify situation, like:
{% extends blogpage|yesno:"blogpage.html,notblogpage.html" %}
this solution allow load template dependent on blogpage
variable, achieving outcome of if statement.
Comments
Post a Comment