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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -