Python / Django - If statement in template around extends -
i have template extends conditionally. basically, when variable called "ajax" true not want have template extend another.
{% if not ajax %} {% extends "/base.html" %} {% endif %}
any clues?
you cannot that. can set variable , use choose template extend:
{% extends my_template %}
then in python code write like:
if ajax: template_values['my_template'] = 'base_ajax.html' else: template_values['my_template'] = 'base.html'
you may wish refer documentation more information.
Comments
Post a Comment